I am trying to encode my video using ffmpeg. I have taken output of each frame as a separate image and then I'm joining them into a video using ffmpeg. I compiled ffmpeg from source.
This is the command I used and the errors I keep running into!
---:/media/New Volume/temp$ ffmpeg -f image2 -i image%1d.png -vcodec libx264 \
-preset ultrafast -crf 15 output.mp4
ffmpeg version git-2012-03-24-2571506 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 24 2012 03:47:02 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora \
--enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 \
--enable-x11grab
libavutil 51. 44.100 / 51. 44.100
libavcodec 54. 12.100 / 54. 12.100
libavformat 54. 2.100 / 54. 2.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 65.102 / 2. 65.102
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 7.100 / 0. 7.100
libpostproc 52. 0.100 / 52. 0.100
// ERORRS::
[png # 0xa4d5120] Missing png signature
[image2 # 0xa4ceb00] decoding for stream 0 failed
[image2 # 0xa4ceb00] Could not find codec parameters (Video: png)
image%1d.png: could not find codec parameters
It's having an error reading your image frames.
Do they open correctly with other software? Are they named image1.png, image2.png, etc.?
Related
How can I merge two .g729 files into one .wav file with ffmpeg?
I used the command
ffmpeg -filter_complex [0\:a][1\:a]amerge\=inputs\=2[aout] -map [aout]
The result is with two files reported .wav and not .g729 and output reported .wav
Here is the FFMPEG data:
ffmpeg version git-2015-07-01-06a0d5e Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.3 (SUSE Linux)
configuration: --prefix=/home/cartella/Encoder_Build --extra-cflags=-I/home/cartella/Encoder_Build/include --extra-ldflags=-L/home/cartella/Encoder_Build/lib --bindir=/home/cartella/Encoder --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --disable-yasm
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 46.100 / 56. 46.100
libavformat 56. 40.100 / 56. 40.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 19.100 / 5. 19.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
With ffmpeg 3.4, you can now render svg image sequences. With the following it works:
ffmpeg -i images/image-%02d.svg video.mp4
However, piping via
cat images/*.svg | ffmpeg -f image2pipe -c:v svg -i - video.mp4
results in the following error
ffmpeg version N-88409-ga8305b0ea3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.37)
configuration: --prefix=./bin --enable-gpl --enable-nonfree --enable-librsvg --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid
libavutil 56. 0.100 / 56. 0.100
libavcodec 58. 1.100 / 58. 1.100
libavformat 58. 0.102 / 58. 0.102
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 0.101 / 7. 0.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.100 / 3. 0.100
libpostproc 55. 0.100 / 55. 0.100
[image2pipe # 0x7fe0d1800000] Could not find codec parameters for stream 0 (Video: svg (librsvg), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, image2pipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: svg, none, 25 tbr, 25 tbn, 25 tbc
Output #0, mp4, to 'video.mp4':
Output file #0 does not contain any stream
Digging into img2dec.c I can see it's probing for <?xml on the first line and <svg on the following line:
static int svg_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;
const uint8_t *end = p->buf + p->buf_size;
if (memcmp(p->buf, "<?xml", 5))
return 0;
while (b < end) {
b += ff_subtitles_next_line(b);
if (b >= end - 4)
return 0;
if (!memcmp(b, "<svg", 4))
return AVPROBE_SCORE_EXTENSION + 1;
}
return 0;
}
All of the svg files in the folder have the appropriate headers
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="640">
What am I missing?
Lastly, I'm using a compiled version of ffmpeg since installing via brew install ffmpeg --with-librsvg didn't seem to work. It installed fine, however it would give the following error
Decoder (codec svg) not found for input stream #0:0
Every time I run this script it doesn't work. I get the output bash: command not found
I ran bash -x to see what was the problem but I don't understand the errors
bash -x mp3towav.sh
+ for f in '*.mp3'
+ ffmpeg -i '' -acodec pcm_s16le -ac 1 -ar .wav
ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Trailing options were found on the commandline.
: No such file or directory
script is this
1 #!/bin/bash
2 for f in *.mp3; do ffmpeg -i "$file" -acodec pcm_s16le -ac 1 -ar "${file%.mp3}".wav;done
when running the corrected code provided I still get an error of:
ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Trailing options were found on the commandline.
Input #0, mp3, from 'hiraeth [ep].mp3':
Duration: 00:23:39.36, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : LAME3.99r
Side data:
replaygain: track gain - -4.100000, track peak - unknown, album gain - unknown, album peak - unknown,
At least one output file must be specified
The solution is of course in the comment by codeforester:
#!/bin/bash
for file in *.mp3; do
ffmpeg -i "$file" -acodec pcm_s16le -ac 1 -ar 44100 "${file%.mp3}".wav
done
(added 44100 per comment LordNeckbeard)
Some hints:
1) if you split your script over multiple lines, it becomes easier to spot errors like this.
2) Don't focus too much on the errors when running bash -x; it gives the on the output the commands. That what it is for. In this case:
+ ffmpeg -i '' -acodec pcm_s16le -ac 1 -ar .wav
The conclusion from this line is that ffmpeg is run with '' as input file and .wav as output.
I have two cameras: an Axis P1347 and an Axis P1357. ffmpeg gets a 400 Bad Request on the P1347 but everything works fine with the P1357.
I am able to successfully stream rtsp video using vlc from an Axis P1347 Camera using the following url:
rtsp://10.8.3.85:554/axis-media/media.amp?videocodec=h264&audio=1
However, this same url in ffmpeg gives the following for the Axis P1347 Camera:
root#ubuntu4-virtual-machine:/home/ubuntu4# ffmpeg -re -v verbose -i "rtsp://10.8.3.85:554/axis-media/media.amp?videocodec=h264&audio=1"
ffmpeg version git-2016-05-02-9fcb59c Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 55. 23.100 / 55. 23.100
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 35.100 / 57. 35.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
rtsp://10.8.3.85:554/axis-media/media.amp?videocodec=h264&audio=1: Server returned 400 Bad Request
The same ffmpeg command works great with the nearly identical Axis P1357 Camera :
root#ubuntu4-virtual-machine:/home/ubuntu4# ffmpeg -re -rtsp_transport tcp -i "rtsp://10.8.3.90:554/axis-media/media.amp?videocodec=h264&audio=1"
ffmpeg version git-2016-05-02-9fcb59c Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 55. 23.100 / 55. 23.100
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 35.100 / 57. 35.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, rtsp, from 'rtsp://10.8.3.90:554/axis-media/media.amp?videocodec=h264&audio=1':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.083300, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 2592x1944 [SAR 1:1 DAR 4:3], 12 tbr, 90k tbn
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Obviously rtsp is turned on and working if vlc can display video, correct? So why does VLC work with the camera, but not ffmpeg? Note ffmpeg is installed and works correctly with a similar camera.
It turns out the P1347 is outputting a 64 bit codec which ffmpeg does not have codecs to ingest. VLC had the 64 bit codecs installed.
I will research how to install 64 bit codecs and use them for the P1347 camera.
Trying to excute following ffmpeg command in ubuntu.
*ffmpeg -i "rtmp://IP/live/1234 live=1" -f flv rtmp://IP/live/1234_56 *
ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 8 2014 13:15:21 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/encoder/ffmpeg_build --extra-cflags=-I/home/encoder/ffmpeg_build/include --extra-ldflags=-L/home/encoder/ffmpeg_build/lib --bindir=/home/encoder/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 52. 74.100 / 52. 74.100
libavcodec 55. 58.102 / 55. 58.102
libavformat 55. 36.102 / 55. 36.102
libavdevice 55. 11.100 / 55. 11.100
libavfilter 4. 3.100 / 4. 3.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
[rtmp # 0x3c5a140] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
^C[flv # 0x3c59b00] Could not find codec parameters for stream 0 (Video: none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv # 0x3c59b00] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
rtmp://IP/live/1234 live=1: could not find codec parameters
Received signal 2: terminating.
I have installed avserver (Libav) earlier to ffmpeg.Kindly suggest any alternative to live=1 or provide suggstion.
This works for ffmpeg version N-71741-ge2877bd :
ffmpeg -rtmp_live live -i "rtmp://IP/live/1234" -f flv rtmp://IP/live/1234_56