[FFmpeg-user] Create webm, m4v and swf slideshow of images

Pascal purrie at gmail.com
Fri Jun 7 15:43:58 CEST 2013


Hi Carl,

You are absolutly right ofcourse. I may as well have included command 
line and output. My apologies.

>> Although with m4v when I use the -shortest command for
>> the mp3 background music ffmpeg suddently decides to
>> add at least twice the time and plays the second half
>> without the music.
> Command line and complete, uncut console output missing.

$ ./ffmpeg -y -loop 1 -f image2 -r 1/5 -pattern_type glob -i '*.jpg' -i 
./Red\ Balloon.mp3 -shortest -s 800x800 out.mp4

ffmpeg version N-40316-g3289670 Copyright (c) 2000-2013 the FFmpeg 
developers
   built on Jun  4 2013 23:00:47 with gcc 4.7 (Debian 4.7.3-4)
   configuration: --extra-cflags=-I../static/include 
--extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 
--enable-static --disable-shared --disable-debug 
--enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 
--enable-libspeex --enable-libvorbis --enable-libvpx 
--enable-libfreetype --enable-libxvid --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc 
--enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg 
--disable-ffserver
   libavutil      52. 34.100 / 52. 34.100
   libavcodec     55. 15.100 / 55. 15.100
   libavformat    55.  8.102 / 55.  8.102
   libavdevice    55.  2.100 / 55.  2.100
   libavfilter     3. 75.101 /  3. 75.101
   libswscale      2.  3.100 /  2.  3.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  3.100 / 52.  3.100
[image2 @ 0x270cea0] max_analyze_duration 5000000 reached at 5000000 
microseconds
Input #0, image2, from '*.jpg':
   Duration: 00:01:45.00, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: mjpeg, yuvj444p, 800x800 [SAR 72:72 DAR 1:1], 
0.20 fps, 1 tbr, 0.20 tbn, 0.20 tbc
[mp3 @ 0x270e960] max_analyze_duration 5000000 reached at 5015510 
microseconds
[mp3 @ 0x270e960] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from './Red Balloon.mp3':
   Metadata:
     title           : Red Balloon
     artist          : Frances England
     album_artist    : Frances England
     TCM             : Frances England
     album           : Mind of My Own
     track           : 4/15
     encoded_by      : iTunes 10.1.1.4
     genre           : Children's Music
     date            : 2010
   Duration: 00:02:17.57, start: 0.000000, bitrate: 160 kb/s
     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 160 kb/s
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x2710c80] using SAR=1/1
[libx264 @ 0x2710c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2710c80] profile High, level 3.1
[libx264 @ 0x2710c80] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
   Metadata:
     encoder         : Lavf55.8.102
     Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), 
yuvj420p, 800x800 [SAR 1:1 DAR 1:1], q=-1--1, 16384 tbn, 0.20 tbc
     Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 
44100 Hz, stereo, s16, 128 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (mjpeg -> libx264)
   Stream #1:0 -> #0:1 (mp3 -> libvo_aacenc)
Press [q] to stop, [?] for help
overread, skip -7 enddists: -6 -6   1769kB time=00:01:00.00 bitrate= 
241.6kbits/s
overread, skip -6 enddists: -4 -4   2389kB time=00:01:25.00 bitrate= 
230.2kbits/s
frame=   78 fps= 15 q=-1.0 Lsize=    7505kB time=00:06:20.00 bitrate= 
161.8kbits/s
video:5331kB audio:2149kB subtitle:0 global headers:0kB muxing overhead 
0.338089%
[libx264 @ 0x2710c80] frame I:19    Avg QP:11.27  size:101361
[libx264 @ 0x2710c80] frame P:59    Avg QP:14.87  size: 59868
[libx264 @ 0x2710c80] mb I  I16..4: 25.4% 52.8% 21.9%
[libx264 @ 0x2710c80] mb P  I16..4: 12.1% 33.9% 16.3%  P16..4: 10.0%  
3.6%  1.9%  0.0%  0.0%    skip:22.2%
[libx264 @ 0x2710c80] 8x8 transform intra:53.9% inter:75.6%
[libx264 @ 0x2710c80] coded y,uvDC,uvAC intra: 77.1% 59.1% 52.0% inter: 
34.0% 13.7% 1.3%
[libx264 @ 0x2710c80] i16 v,h,dc,p: 81%  5%  4% 10%
[libx264 @ 0x2710c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 16% 18% 6%  8%  
8%  9%  9%  9%
[libx264 @ 0x2710c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 16% 10%  8% 11% 
10% 10%  9%  9%
[libx264 @ 0x2710c80] i8c dc,h,v,p: 66% 15% 12%  7%
[libx264 @ 0x2710c80] Weighted P-Frames: Y:32.2% UV:25.4%
[libx264 @ 0x2710c80] ref P L0: 90.8%  0.7%  7.3%  1.3%
[libx264 @ 0x2710c80] kb/s:111.96


So duration of the music is 00:02:17.57, duration of the video is 
00:06:20.00.


>> When I create webm format the solution for images to
>> stay on screen (-r 1/5) gives an error.
> Command line and complete, uncut consol output missing.

pascal at kayenta:$ ./ffmpeg -y -loop 1 -f image2 -r 1/5 -pattern_type glob 
-i '*.jpg' -i ./Red\ Balloon.mp3 -shortest -s 800x800 out.webm

ffmpeg version N-40316-g3289670 Copyright (c) 2000-2013 the FFmpeg 
developers
   built on Jun  4 2013 23:00:47 with gcc 4.7 (Debian 4.7.3-4)
   configuration: --extra-cflags=-I../static/include 
--extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 
--enable-static --disable-shared --disable-debug 
--enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 
--enable-libspeex --enable-libvorbis --enable-libvpx 
--enable-libfreetype --enable-libxvid --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc 
--enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg 
--disable-ffserver
   libavutil      52. 34.100 / 52. 34.100
   libavcodec     55. 15.100 / 55. 15.100
   libavformat    55.  8.102 / 55.  8.102
   libavdevice    55.  2.100 / 55.  2.100
   libavfilter     3. 75.101 /  3. 75.101
   libswscale      2.  3.100 /  2.  3.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  3.100 / 52.  3.100
[image2 @ 0x3b52ea0] max_analyze_duration 5000000 reached at 5000000 
microseconds
Input #0, image2, from '*.jpg':
   Duration: 00:01:45.00, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: mjpeg, yuvj444p, 800x800 [SAR 72:72 DAR 1:1], 
0.20 fps, 1 tbr, 0.20 tbn, 0.20 tbc
[mp3 @ 0x3b54960] max_analyze_duration 5000000 reached at 5015510 
microseconds
[mp3 @ 0x3b54960] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from './Red Balloon.mp3':
   Metadata:
     title           : Red Balloon
     artist          : Frances England
     album_artist    : Frances England
     TCM             : Frances England
     album           : Mind of My Own
     track           : 4/15
     encoded_by      : iTunes 10.1.1.4
     genre           : Children's Music
     date            : 2010
   Duration: 00:02:17.57, start: 0.000000, bitrate: 160 kb/s
     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 160 kb/s
[libvpx @ 0x3b56c80] v1.2.0-2110-gb71542d
[libvpx @ 0x3b56c80] Failed to initialize encoder: Invalid parameter
[libvpx @ 0x3b56c80]   Additional information: g_timebase.num out of 
range [1..cfg->g_timebase.den]
Output #0, webm, to 'out.webm':
     Stream #0:0: Video: vp8, yuv420p, 800x800 [SAR 1:1 DAR 1:1], 
q=-1--1, 200 kb/s, 90k tbn, 0.20 tbc
     Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp
Stream mapping:
   Stream #0:0 -> #0:0 (mjpeg -> libvpx)
   Stream #1:0 -> #0:1 (mp3 -> libvorbis)
Error while opening encoder for output stream #0:0 - maybe incorrect 
parameters such as bit_rate, rate, width or height


If I remove the -r 1/5:

./ffmpeg -y -loop 1 -f image2 -pattern_type glob -i '*.jpg' -i ./Red\ 
Balloon.mp3 -shortest -s 800x800 out.webm

ffmpeg version N-40316-g3289670 Copyright (c) 2000-2013 the FFmpeg 
developers
   built on Jun  4 2013 23:00:47 with gcc 4.7 (Debian 4.7.3-4)
   configuration: --extra-cflags=-I../static/include 
--extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 
--enable-static --disable-shared --disable-debug 
--enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 
--enable-libspeex --enable-libvorbis --enable-libvpx 
--enable-libfreetype --enable-libxvid --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc 
--enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg 
--disable-ffserver
   libavutil      52. 34.100 / 52. 34.100
   libavcodec     55. 15.100 / 55. 15.100
   libavformat    55.  8.102 / 55.  8.102
   libavdevice    55.  2.100 / 55.  2.100
   libavfilter     3. 75.101 /  3. 75.101
   libswscale      2.  3.100 /  2.  3.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from '*.jpg':
   Duration: 00:00:00.84, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: mjpeg, yuvj444p, 800x800 [SAR 72:72 DAR 1:1], 
25 fps, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0x30d2da0] max_analyze_duration 5000000 reached at 5015510 
microseconds
[mp3 @ 0x30d2da0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from './Red Balloon.mp3':
   Metadata:
     title           : Red Balloon
     artist          : Frances England
     album_artist    : Frances England
     TCM             : Frances England
     album           : Mind of My Own
     track           : 4/15
     encoded_by      : iTunes 10.1.1.4
     genre           : Children's Music
     date            : 2010
   Duration: 00:02:17.57, start: 0.000000, bitrate: 160 kb/s
     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 160 kb/s
[libvpx @ 0x30d5ea0] v1.2.0-2110-gb71542d
Output #0, webm, to 'out.webm':
   Metadata:
     encoder         : Lavf55.8.102
     Stream #0:0: Video: vp8 (libvpx), yuv420p, 800x800 [SAR 1:1 DAR 
1:1], q=-1--1, 200 kb/s, 1k tbn, 25 tbc
     Stream #0:1: Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp
Stream mapping:
   Stream #0:0 -> #0:0 (mjpeg -> libvpx)
   Stream #1:0 -> #0:1 (mp3 -> libvorbis)
Press [q] to stop, [?] for help
overread, skip -7 enddists: -6 -6  4969kB time=00:00:55.80 bitrate= 
729.5kbits/s
overread, skip -6 enddists: -4 -4  8655kB time=00:01:37.64 bitrate= 
726.2kbits/s
frame= 3437 fps= 26 q=0.0 Lsize=   12166kB time=00:02:17.48 bitrate= 
724.9kbits/s
video:10152kB audio:1884kB subtitle:0 global headers:4kB muxing overhead 
1.041554%

Video duration is 02:17 same as the  song is. But the images ofcourse do 
not have a duration of 5 seconds.


All input images are 800x800px.

I worked around the fact that with mp4 videos and this mp3 file it plays 
for over 6 minutes by setting a time limit with -t 00:02:15. This is 
however not ideal as it may happen there are more images for the 
slideshow than there is a song :-)

Thank you,

Pascal


More information about the ffmpeg-user mailing list