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
Related
Quicktime can't read the output of ffmpeg when I try making an animation. It uploads to imgur and plays no problem. A previous thread recommended that I add the -pix_fmt yuv420p flag. But, on my system, that does not work. ffmpeg runs without error when I exclude the pix_fmt flag, but I cannot open the output animation in quicktime.
Why won't quicktime open the animation? How can I make the animation open with quicktime?
$ ffmpeg -y -i animation/tigers_${ii}_%05d.png -pix_fmt yuv420p tiger${ii}.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, image2, from 'animation/tigers_1.10_%05d.png':
Duration: 00:00:08.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 2023x3036 [SAR 17716:17716 DAR 2023:3036], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
The error is clear,
[libx264 # 0x7fdd7b800c00] width not divisible by 2 (2023x3036)
Use the crop filter to get rid of one column of pixels:
ffmpeg -y -i animation/tigers_${ii}_%05d.png -vf "crop='iw-mod(iw,2)':'ih-mod(ih,2)',format=yuv420p" tiger${ii}.mp4
The -pix_fmt option is equivalent to adding the format filter as the last filter.
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
I am trying to get PCM data from mp3's using ffmpeg, but the files are stored on a database, gridfs, so I am trying to use pipes to give ffmpeg the data with some sucess, however there is one file which ffmpeg handles correctlt if fed the filename as an input, and incorrectly when given the file as a pipe :( any idea why?
ffmpeg -i - -f s16le -acodec pcm_s16le output.raw < testMp3s/test-corrupt.mp3
gives
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 9 2012 13:50:13 with gcc 4.7.0 20120505 (prerelease)
configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid -- enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex -- enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-libv4l2 --enable-gpl --enable-version3 --enable-runtime-cpudetect -- disable-debug --disable-static
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mp3 # 0x16d7100] Unknown attached picture mimetype: JPG, skipping.
[mp3 # 0x16d7100] max_analyze_duration 5000000 reached at 5015510
[mp3 # 0x16d7100] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'pipe:':
Metadata:
album : FreshNewMusik.Com
encoded_by : iTunes 10.6.3
title : No Lie (Freestyle)
artist : Lil Wayne
album_artist : Lil Wayne
genre : Hip-Hop/Rap
TT3 : twitter.com/jakejarvis
date : 2012
Duration: N/A, start: 0.000000, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 320 kb/s
Yet
ffmpeg -i testMp3s/test-corrupt.mp3 -f s16le -acodec pcm_s16le output.raw
gives
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 9 2012 13:50:13 with gcc 4.7.0 20120505 (prerelease)
configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid -- enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-libpulse --enable-libv4l2 --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mp3 # 0xf33100] Unknown attached picture mimetype: JPG, skipping.
[mp3 # 0xf33100] max_analyze_duration 5000000 reached at 5015510
[mp3 # 0xf33100] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'testMp3s/test-corrupt.mp3':
Metadata:
album : FreshNewMusik.Com
encoded_by : iTunes 10.6.3
title : No Lie (Freestyle)
artist : Lil Wayne
album_artist : Lil Wayne
genre : Hip-Hop/Rap
TT3 : twitter.com/jakejarvis
date : 2012
Duration: 00:02:33.86, start: 0.000000, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 320 kb/s
How do I get the duration with the pipe? (the data is available on memory in a python app)
[mp3 # 0xf33100] Estimating duration from bitrate, this may be inaccurate
When given a real file, ffmpeg can get the sizes of the file using stat. Duration is size / bitrate. But when it gets stdio, it has no way to tell how much data to expect. In fact, if it's getting a stream, there may not even be a well-defined duration. As I recall, MP3s can provide duration in the id3 tags at the start of the file, which is why some of your files do show a duration.