Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques converting series of images to a video slideshow

  • converting series of images to a video slideshow

    Posted by C david Young on September 22, 2011 at 5:43 pm

    I wish to convert a series of images (.jpg) to a video slideshow where I can specify how long each image is displayed. In addition I would like to add narration to each image as well as specify a music track. The output should be compatible with youtube/facebook. Can anyone suggest an ffmpeg command line to accomplish this? I have been playing around with the documented technique (ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi) but am not having much luck.

    Thanks in advance.

    C david Young replied 14 years, 10 months ago 2 Members · 7 Replies
  • 7 Replies
  • Michael Rampe

    September 22, 2011 at 8:41 pm

    [C David Young] “(ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi) but am not having much luck.”

    What is going wrong?

    Michael

  • C david Young

    September 22, 2011 at 9:17 pm

    Well, for one thing it only seems to be adding the first image, which only shows up briefly when playing in VLC. If I set the frame rate really low (-r .1) the image shows longer but I don’t think that is the right technique. So I guess the first hurdle is to figure out why only the first image is showing up. The output below seems to indicate that only the first image is being processed.

    C:Androidffmpeg for windowsffmpeg-git-a254452-win32-staticbin>ffmpeg -y -f image2 -i IMAG-%03d.jpg -s 720×480 a.mp4
    ffmpeg version N-32726-ga254452, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 19 2011 19:49:13 with gcc 4.6.1
    configuration: –enable-gpl –enable-version3 –enable-runtime-cpudetect –enable-avisynth –enable-bzlib –enable-frei0r –enable-libopencore-amrnb
    libavutil 51. 16. 1 / 51. 16. 1
    libavcodec 53. 16. 0 / 53. 16. 0
    libavformat 53. 12. 0 / 53. 12. 0
    libavdevice 53. 4. 0 / 53. 4. 0
    libavfilter 2. 43. 2 / 2. 43. 2
    libswscale 2. 1. 0 / 2. 1. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Input #0, image2, from ‘IMAG-%03d.jpg’:
    Duration: 00:00:00.28, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 3264×1952, 25 fps, 25 tbr, 25 tbn, 25 tbc
    [buffer @ 024C5FE0] w:3264 h:1952 pixfmt:yuvj420p tb:1/1000000 sar:0/1 sws_param:
    [scale @ 024C5060] w:3264 h:1952 fmt:yuvj420p -> w:720 h:480 fmt:yuvj420p flags:0x4
    [libx264 @ 02511A60] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
    [libx264 @ 02511A60] profile High, level 3.0
    [libx264 @ 02511A60] 264 – core 116 r2074 2641b9e – H.264/MPEG-4 AVC codec – Copyleft 2003-2011 – https://www.videolan.org/x264.html – options: cabac=1
    eightp=2 keyint=250 keyint_min=25 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
    Output #0, mp4, to ‘a.mp4’:
    Metadata:
    encoder : Lavf53.12.0
    Stream #0.0: Video: h264 (![0][0][0] / 0x0021), yuvj420p, 720×480, q=-1–1, 25 tbn, 25 tbc
    Stream mapping:
    Stream #0.0 -> #0.0 (mjpeg -> libx264)
    Press [q] to stop, [?] for help
    frame= 7 fps= 0 q=-1.0 Lsize= 84kB time=00:00:00.20 bitrate=3451.2kbits/s
    video:83kB audio:0kB global headers:0kB muxing overhead 1.000866%
    frame I:1 Avg QP:25.84 size: 16625
    [libx264 @ 02511A60] frame P:6 Avg QP:26.97 size: 11349
    [libx264 @ 02511A60] mb I I16..4: 15.7% 59.7% 24.6%
    [libx264 @ 02511A60] mb P I16..4: 12.1% 54.0% 16.5% P16..4: 1.3% 0.2% 0.2% 0.0% 0.0% skip:15.8%
    [libx264 @ 02511A60] 8×8 transform intra:64.4% inter:84.1%
    [libx264 @ 02511A60] coded y,uvDC,uvAC intra: 60.8% 70.7% 30.0% inter: 3.1% 5.7% 0.1%
    [libx264 @ 02511A60] i16 v,h,dc,p: 35% 14% 3% 48%
    [libx264 @ 02511A60] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 14% 14% 7% 8% 8% 8% 9% 9%
    [libx264 @ 02511A60] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 18% 13% 7% 9% 8% 7% 6% 4%
    [libx264 @ 02511A60] i8c dc,h,v,p: 50% 17% 23% 10%
    [libx264 @ 02511A60] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 02511A60] ref P L0: 69.4% 5.4% 11.1% 14.1%
    [libx264 @ 02511A60] kb/s:2420.51

  • C david Young

    September 22, 2011 at 9:32 pm

    As I read more about ffmpeg I figure my best approach might be to create a separate video file of the correct duration for each image muxed with the narration, and then concatenate the files while muxing the music. Does that make any sense?

  • Michael Rampe

    September 22, 2011 at 9:35 pm

    [C David Young] “Well, for one thing it only seems to be adding the first image,”

    Are your images are *definitely* named IMAG-001.jpg. IMAG-002.jpg, IMAG-003.jpg …etc?

    I tired your line with a series of images named this way and it works…. so not sure otherwise….

    Michael

  • C david Young

    September 22, 2011 at 10:29 pm

    Yes, that is how my image files are named.

    What does your output look like? Does it dwell for a second or two on each image? What OS are you running? Which player are you using?

    Thanks!

  • Michael Rampe

    September 22, 2011 at 10:45 pm

    [C David Young] “What does your output look like? Does it dwell for a second or two on each image? What OS are you running? Which player are you using?

    OK. I dug a little further….

    I split a movie into files for testing and then reassembled with your code.
    When I tried to change the frame rate, I got the same bug as you.
    I fixed this by putting the -r 1 BEFORE the input.
    Now I get one frame playing per second.

    $ ffmpeg -y -f image2 -r 1 -i test-%03d.jpg -s 720×480 a.mp4

    FYI: OSX 10.7, QT/VLC

    Michael

  • C david Young

    September 23, 2011 at 11:05 am

    Wow. With the following line (-r .2) I was able to get each image to show for 5 seconds. Thanks!

    $ ffmpeg -y -f image2 -r .2 -i test-%03d.jpg -s 720×480 a.mp4

    Now regarding the audio clips that I want to play in synchronization with the images, is there a similar command for muxing the audio files (.3gp) with this a.mp4? Or should I mux the audio files with the images first to create a series of .mp4 files and then concatenate them?

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy