Images to video in Prezi format - image

I have five *.jpeg image files: m01.jpeg to m05.jpeg.
I'd like to make a video of a sequence of these five images and upload it to Prezi to use in a presentation.
FFMPEG seems to be the tool for the job here. I am generating a video using the following command:
ffmpeg -r 2 -i m%02d.jpeg -pix_fmt yuvj420p myvideo.mp4
This generates a video that I can play fine locally. Unfortunately, when I try to upload the video to Prezi, I always get the following error...
"Technical details: id: 2110 the reason is: Event [Event type="stateChange" bubbles=false cancelable=false eventPhase=2]"
...which isn't particularly informative.
If I upload a sample MP4 from the web to Prezi, it works fine.
My question: Does anybody know what I need to give FFMPEG as parameters here so that it will generate a Prezi-compatible video from these images?
EDIT: As requested, here's the complete console output for FFMPEG. Unfortunately there are no glaring warnings or errors that I can see.
sam#x220sm:~/tmp$ ffmpeg -r 2 -i m%02d.jpeg -pix_fmt yuvj420p myvideo.mp4
ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311
configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0xd8e620] Changeing bps to 8
Input #0, image2, from 'm%02d.jpeg':
Duration: 00:00:00.20, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 800x600 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 # 0xd910c0] using SAR=1/1
[libx264 # 0xd910c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0xd910c0] profile High, level 3.1
[libx264 # 0xd910c0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 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=2 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 'myvideo.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 800x600 [SAR 1:1 DAR 4:3], q=-1--1, 2 fps, 16384 tbn, 2 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 5 fps=0.0 q=-1.0 Lsize= 1170kB time=00:00:01.50 bitrate=6390.8kbits/s
video:1169kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.073660%
[libx264 # 0xd910c0] frame I:1 Avg QP:25.54 size:289842
[libx264 # 0xd910c0] frame P:4 Avg QP:20.54 size:226716
[libx264 # 0xd910c0] mb I I16..4: 0.0% 0.2% 99.8%
[libx264 # 0xd910c0] mb P I16..4: 16.8% 23.8% 59.4% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip: 0.0%
[libx264 # 0xd910c0] 8x8 transform intra:19.1% inter:0.0%
[libx264 # 0xd910c0] coded y,uvDC,uvAC intra: 84.5% 85.6% 79.2% inter: 50.0% 100.0% 100.0%
[libx264 # 0xd910c0] i16 v,h,dc,p: 95% 1% 4% 0%
[libx264 # 0xd910c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 6% 8% 38% 7% 7% 6% 11% 9% 9%
[libx264 # 0xd910c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 9% 23% 9% 9% 8% 14% 9% 11%
[libx264 # 0xd910c0] i8c dc,h,v,p: 72% 10% 5% 13%
[libx264 # 0xd910c0] Weighted P-Frames: Y:50.0% UV:50.0%
[libx264 # 0xd910c0] ref P L0: 50.0% 50.0%
[libx264 # 0xd910c0] kb/s:3829.46

Make sure to use a "standard" frame rate and a compatible chroma subsampling scheme:
ffmpeg -framerate 2 -i m%02d.jpeg -r 25 -pix_fmt yuv420p -profile:v baseline -movflags +faststart output.mp4
Options:
-framerate 2 Set input frame rate to 2. Note that the image demuxer uses -framerate instead of -r.
-r 25 Set the output frame rate to 25.
-pix_fmt yuv420p Ensures 4:2:0 chroma subsampling.
-profile:v baseline Use Baseline H.264 profile. Possibly not needed for Prezi.
-movflags +faststart For playback via progressive download–allows video to begin playback before file is completely downloaded. Possibly not needed for Prezi, but does not harm anything to include it.

Related

omxplayer freezes with videos generated with FFMPEG

Omxplayer won't play any videos generated with FFmpeg on a Raspberry Pi
I found this thread showing that it is necessary to include '-profile baseline -level 3.0' parameters: https://github.com/popcornmix/omxplayer/issues/577
The full command is:
ffmpeg -framerate 1/10 -pattern_type glob -i '*.jpg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.mp4
I did that and now I am experiencing intermittent behavior.
Sometimes it works and sometimes it does not work. I cannot explain why/when it plays or not.
I also found a thread showing that it is necessary to upgrade the firmware and player. I did that and still having the same issue.
Here is an example. First time it plays ok. Second time it freezes.
First time: creating mp4
(env) pi#raspberrypi:~/mkt $ ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.mp4
ffmpeg version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from 'mensagens/*.jpeg':
Duration: 00:01:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1024x768 [SAR 72:72 DAR 4:3], 0.10 fps, 0.10 tbr, 0.10 tbn, 0.10 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 0x182ad70] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0x17b1170] using SAR=1/1
[libx264 # 0x17b1170] frame MB size (64x48) > level limit (1620)
[libx264 # 0x17b1170] using cpu capabilities: none!
[libx264 # 0x17b1170] profile Constrained Baseline, level 3.0
[libx264 # 0x17b1170] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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 'images.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], q=-1--1, 0.10 fps, 16384 tbn, 0.10 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 7 fps=0.7 q=15.0 Lsize= 79kB time=00:01:00.00 bitrate= 10.8kbits/s speed=5.66x
video:78kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.085207%
[libx264 # 0x17b1170] frame I:3 Avg QP: 2.03 size: 14789
[libx264 # 0x17b1170] frame P:4 Avg QP: 5.28 size: 8794
[libx264 # 0x17b1170] mb I I16..4: 91.0% 0.0% 9.0%
[libx264 # 0x17b1170] mb P I16..4: 26.1% 0.0% 3.8% P16..4: 3.4% 1.3% 1.0% 0.0% 0.0% skip:64.4%
[libx264 # 0x17b1170] coded y,uvDC,uvAC intra: 6.5% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x17b1170] i16 v,h,dc,p: 97% 1% 2% 0%
[libx264 # 0x17b1170] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 19% 20% 4% 3% 4% 3% 3% 3%
[libx264 # 0x17b1170] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x17b1170] ref P L0: 55.1% 44.9%
[libx264 # 0x17b1170] kb/s:9.09
First time playing mp4 (it plays OK):
(env) pi#raspberrypi:~/mkt $ omxplayer images.mp4
Invalid framerate 0, using forced 25fps and just trust timestamps
Video codec omx-h264 width 1024 height 768 profile 578 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1024x768#0.10 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:0 layer:0 alpha:255 aspectMode:0
have a nice day ;)
Second time creating mp4 (nothing changes):
(env) pi#raspberrypi:~/mkt $ ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile baseline -level 3.0 images.mp4
ffmpeg version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from 'mensagens/*.jpeg':
Duration: 00:01:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1024x768 [SAR 72:72 DAR 4:3], 0.10 fps, 0.10 tbr, 0.10 tbn, 0.10 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
File 'images.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 0x1c5fd70] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0x1be6170] using SAR=1/1
[libx264 # 0x1be6170] frame MB size (64x48) > level limit (1620)
[libx264 # 0x1be6170] using cpu capabilities: none!
[libx264 # 0x1be6170] profile Constrained Baseline, level 3.0
[libx264 # 0x1be6170] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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 'images.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], q=-1--1, 0.10 fps, 16384 tbn, 0.10 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 7 fps=0.7 q=15.0 Lsize= 79kB time=00:01:00.00 bitrate= 10.8kbits/s speed=5.78x
video:78kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.085207%
[libx264 # 0x1be6170] frame I:3 Avg QP: 2.03 size: 14789
[libx264 # 0x1be6170] frame P:4 Avg QP: 5.28 size: 8794
[libx264 # 0x1be6170] mb I I16..4: 91.0% 0.0% 9.0%
[libx264 # 0x1be6170] mb P I16..4: 26.1% 0.0% 3.8% P16..4: 3.4% 1.3% 1.0% 0.0% 0.0% skip:64.4%
[libx264 # 0x1be6170] coded y,uvDC,uvAC intra: 6.5% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1be6170] i16 v,h,dc,p: 97% 1% 2% 0%
[libx264 # 0x1be6170] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 19% 20% 4% 3% 4% 3% 3% 3%
[libx264 # 0x1be6170] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1be6170] ref P L0: 55.1% 44.9%
[libx264 # 0x1be6170] kb/s:9.09
Second time playing mp4 (it freezes. I had to ctrl-c to interrupt):
(env) pi#raspberrypi:~/mkt $ omxplayer images.mp4
Invalid framerate 0, using forced 25fps and just trust timestamps
Video codec omx-h264 width 1024 height 768 profile 578 fps 25.000000
Subtitle count: 0, state: off, index: 1, delay: 0
Stopped at: 00:00:00
have a nice day ;)
Most players don't like such a low frame rate. Add -r 10 output option:
ffmpeg -framerate 1/10 -pattern_type glob -i 'mensagens/*.jpeg' -c:v libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -r 10 images.mp4
You don't have to use -r 10 specifically. It was an arbitrary example that should be high enough for most players but feel free to experiment.
Frames will be duplicated to go from 1/10 to 10, but the output will look the same and play at the correct speed.
You may not need -level, or at least not 3.0 (which your input attributes exceed anyway). You may not even need -profile:v, or try -profile:v main instead.

ffmpeg : audio + image to video : reduce time and space it takes

I am using FFMPEG to convert an image and an audio to a video.
I am able to achieve the final video using the following command (Attaching the output of the command too) :
time ffmpeg -loop 1 -i inputImage.jpg -i inputAudio.mp3 -c:v libx264 -
c:a copy -shortest output1.mp4
ffmpeg version 4.1.3-0york1~16.04 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --prefix=/usr --extra-version='0york1~16.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from 'inputImage.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 32003 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 4160x2340 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[mp3 # 0x55cd4bed0f80] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'inputAudio.mp3':
Duration: 00:00:23.77, start: 0.000000, bitrate: 127 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 # 0x55cd4bee9c80] using SAR=1/1
[libx264 # 0x55cd4bee9c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x55cd4bee9c80] profile High, level 6.0
[libx264 # 0x55cd4bee9c80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=6 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=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.40 aq=1:1.00
Output #0, mp4, to 'output1.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc), 4160x2340 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 128 kb/s
frame= 647 fps= 21 q=28.0 Lsize= 1302kB time=00:00:23.76 bitrate= 449.0kbits/s speed=0.778x
video:908kB audio:371kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.797463%
[libx264 # 0x55cd4bee9c80] frame I:3 Avg QP:12.36 size:235361
[libx264 # 0x55cd4bee9c80] frame P:163 Avg QP:17.66 size: 469
[libx264 # 0x55cd4bee9c80] frame B:481 Avg QP:20.95 size: 336
[libx264 # 0x55cd4bee9c80] consecutive B-frames: 0.8% 0.3% 0.0% 98.9%
[libx264 # 0x55cd4bee9c80] mb I I16..4: 60.6% 37.5% 1.9%
[libx264 # 0x55cd4bee9c80] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.3% 0.0% 0.0% 0.0% 0.0% skip:99.7%
[libx264 # 0x55cd4bee9c80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0:46.7% L1:53.3% BI: 0.0%
[libx264 # 0x55cd4bee9c80] 8x8 transform intra:36.9% inter:94.7%
[libx264 # 0x55cd4bee9c80] coded y,uvDC,uvAC intra: 29.0% 60.8% 5.5% inter: 0.0% 0.1% 0.0%
[libx264 # 0x55cd4bee9c80] i16 v,h,dc,p: 19% 67% 14% 0%
[libx264 # 0x55cd4bee9c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 42% 41% 1% 0% 0% 0% 0% 8%
[libx264 # 0x55cd4bee9c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 60% 5% 0% 0% 0% 0% 0% 0%
[libx264 # 0x55cd4bee9c80] i8c dc,h,v,p: 24% 56% 16% 5%
[libx264 # 0x55cd4bee9c80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x55cd4bee9c80] ref P L0: 96.2% 0.0% 1.8% 2.0%
[libx264 # 0x55cd4bee9c80] ref B L0: 87.7% 8.6% 3.7%
[libx264 # 0x55cd4bee9c80] ref B L1: 98.5% 1.5%
[libx264 # 0x55cd4bee9c80] kb/s:291.81
real 0m30.671s
user 1m50.724s
sys 0m0.348s
Here are the respected sizes of inputs and output:
inputImage.jpg : 160kb
inputAudio.mp3 : 380.3kb
output1.mp4 : 1.3MB
The size of output video is pretty large as compared to the input audio. This is my first issue.
Secondly, as you can see, this process takes ~30sec, which is too much I think.
How do I solve this two problems?
reducing the output video file size
reducing the time this process takes.
I've gone through numerous online links, including a lot of questions on this forum for the past several hours but still not able to solve this.
Tried playing with framerate but disturbs the duration of the output video.
Can someone please help here. Let me know if any other information is needed.
1 thing that helped me reduce the size of final video from 3MB to 1.2MB was to compress the image that I am using.
Both your issues are due to the same cause. FFmpeg has generated the video by repeating the image 647 times. Your output file has 647 video frames at 21 FPS. This info is displayed in your console output.
frame= 647 fps= 21 q=28.0 Lsize= 1302kB time=00:00:23.76 bitrate= 449.0kbits/s speed=0.778x
You can optimise this by one or more of the following ways
Decrease output video resolution (-s lower-resolution)
Decrease output video bitrate (-vb lower-video-bitrate)
Decrease output FPS (-r lower-frame-rate)

FFMPEG does not add images to audio

I want to create a slideshow with a background music by ffmpeg, and use the command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
and map.txt is like
file '1.jpg'
duration 15
file '2.jpg'
duration 60
The result is a video with the audio and blank background. If I run the above command without audio as
ffmpeg -f concat -safe 0 -i map.txt -pix_fmt yuv420p -strict -2 video.mp4
a perfect video of the images (the intended slideshow) is generated (but obviously without audio).
I reckon the problem is related to synchronising the audio and images.
This is the terminal output for the first command
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1cc8d40] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:05:48.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1ccdf80] using SAR=1/1
[libx264 # 0x1ccdf80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1ccdf80] profile High, level 4.0
[libx264 # 0x1ccdf80] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=12 lookahead_threads=2 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=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.40 aq=1:1.00
Output #0, mp4, to 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7fe688001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1ccdf80] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1ccdf80] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1ccdf80] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1ccdf80] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1ccdf80] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1ccdf80] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1ccdf80] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1ccdf80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1ccdf80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1ccdf80] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1ccdf80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1ccdf80] kb/s:20.65
UPDATE (following the comment suggestion)
ffmpeg -f concat -safe 0 -i map.txt -i audio.flac -vsync vfr -r 5 -pix_fmt yuv420p -strict -2 video.mp4
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 0x1fe9d80] Changeing bps to 8
Input #0, concat, from 'map.txt':
Duration: 00:02:28.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, gray(bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, flac, from 'audio.flac':
Metadata:
TITLE : Speak to Me
ARTIST : Creator
ALBUM : Acoustic Hits
track : 14
GENRE : Pop
DATE : 2011
Duration: 00:03:31.02, start: 0.000000, bitrate: 1026 kb/s
Stream #1:0: Audio: flac, 44100 Hz, stereo, s16
[libx264 # 0x1feefc0] using SAR=1/1
[libx264 # 0x1feefc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x1feefc0] profile High, level 4.0
[libx264 # 0x1feefc0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=12 lookahead_threads=2 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=5 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 'video.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 5 fps, 10240 tbn, 5 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp (16 bit), 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
[mjpeg # 0x7f74cc001ba0] Changeing bps to 8
frame= 2 fps=0.7 q=-1.0 Lsize= 3593kB time=00:03:31.02 bitrate= 139.5kbits/s
video:147kB audio:3410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.036417%
[libx264 # 0x1feefc0] frame I:1 Avg QP: 2.55 size: 33683
[libx264 # 0x1feefc0] frame P:1 Avg QP:19.33 size:116022
[libx264 # 0x1feefc0] mb I I16..4: 89.7% 1.1% 9.3%
[libx264 # 0x1feefc0] mb P I16..4: 0.9% 1.8% 30.1% P16..4: 1.4% 1.5% 0.9% 0.0% 0.0% skip:63.4%
[libx264 # 0x1feefc0] 8x8 transform intra:2.1% inter:15.2%
[libx264 # 0x1feefc0] coded y,uvDC,uvAC intra: 19.7% 0.0% 0.0% inter: 2.8% 0.0% 0.0%
[libx264 # 0x1feefc0] i16 v,h,dc,p: 97% 2% 2% 0%
[libx264 # 0x1feefc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 39% 1% 1% 2% 1% 2% 4%
[libx264 # 0x1feefc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 16% 16% 3% 4% 6% 5% 5% 4%
[libx264 # 0x1feefc0] i8c dc,h,v,p: 100% 0% 0% 0%
[libx264 # 0x1feefc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1feefc0] kb/s:20.65

ffmpeg slideshow video from images creating empty mp4

I'm trying to use ffmpeg to create an .mp4 from a set of .JPG files. This is the ffmpeg line I'm using:
ffmpeg -framerate 1/5 -i image-%03d.JPG output.mp4
which returns:
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg # 04ee8ca0] Changeing bps to 8
Input #0, image2, from 'image-%03d.JPG':
Duration: 00:01:05.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 4608x3072, 0.20 tbr, 0.20 tbn, 0.20 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
No pixel format specified, yuvj422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 # 04ef4a40] frame MB size (288x192) > level limit (36864)
[libx264 # 04ef4a40] DPB size (4 frames, 221184 mbs) > level limit (3 frames, 184320 mbs)
[libx264 # 04ef4a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 04ef4a40] profile High 4:2:2, level 5.2, 4:2:2 8-bit
[libx264 # 04ef4a40] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 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 'output.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj422p(pc), 4608x3072, q=-1--1, 0.20 fps, 16384 tbn, 0.20 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 13 fps=0.9 q=-1.0 Lsize= 18249kB time=00:00:55.00 bitrate=2718.2kbits/s
video:18249kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005057%
[libx264 # 04ef4a40] frame I:1 Avg QP:13.94 size:1564617
[libx264 # 04ef4a40] frame P:12 Avg QP:13.68 size:1426766
[libx264 # 04ef4a40] mb I I16..4: 2.6% 79.2% 18.2%
[libx264 # 04ef4a40] mb P I16..4: 2.2% 82.9% 14.6% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip: 0.2%
[libx264 # 04ef4a40] 8x8 transform intra:82.9% inter:79.9%
[libx264 # 04ef4a40] coded y,uvDC,uvAC intra: 95.0% 80.5% 67.2% inter: 33.6% 27.6% 11.4%
[libx264 # 04ef4a40] i16 v,h,dc,p: 16% 9% 5% 69%
[libx264 # 04ef4a40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 20% 24% 6% 8% 6% 8% 6% 10%
[libx264 # 04ef4a40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 22% 10% 8% 11% 8% 11% 6% 9%
[libx264 # 04ef4a40] i8c dc,h,v,p: 52% 20% 20% 7%
[libx264 # 04ef4a40] Weighted P-Frames: Y:8.3% UV:8.3%
[libx264 # 04ef4a40] ref P L0: 64.6% 9.0% 11.8% 5.8% 8.8%
[libx264 # 04ef4a40] kb/s:2299.79
and a output.mp4. When I run this file, it ends immediately without showing any images. I don't see any errors or problems in the code, so I'm not sure what I'm doing wrong. Do I need to increase the video framerate or something else?
Some players have troubles with low framerates. Also, the pixel format may not be supported by the player.
Use
ffmpeg -framerate 1/5 -i image-%03d.JPG -r 5 -pix_fmt yuv420p output.mp4

Turning images into videos with ffmpeg

I asked this on another forum but never had any luck. I found the following command online that is supposed to create a video from images(duration of 5 seconds each) using FFmpeg.
ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 out.mp4
I have ran that and I have two images named img001.png and img002.png, however when I play out.mp4, it's only a 5 second clip with img001.png being played. What's really strange as well, is in my Windows Media Player, it thinks it's 10 seconds long (2 images # 10 seconds), but when the gauge gets half way through(5 seconds) the video, it ends.
Any suggestions of what could be going on?
I also tried a bunch of other commands I found online but never had any luck. They would end up showing both images, but the first one would just flash for a fraction of a second, or some other ones would do the same thing would happen to the second image at the end of the video.
I have it ImageMagick installed into XAMPP on my Windows Vista PC. I can provide my command line output from the command if needed.
Edit: Added command line output
C:\xampp\htdocs>ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 out.mp4
ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 19.100 / 52. 19.100
libavcodec 55. 0.100 / 55. 0.100
libavformat 55. 0.100 / 55. 0.100
libavdevice 54. 4.100 / 54. 4.100
libavfilter 3. 45.103 / 3. 45.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, image2, from 'img%03d.png':
Duration: 00:00:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24, 800x600 [SAR 1:1 DAR 4:3], 0.20 tbr, 0.20 tb
n, 0.20 tbc
[libx264 # 0032cae0] using SAR=1/1
[libx264 # 0032cae0] using cpu capabilities: MMX2 SSE2Slow SlowCTZ
[libx264 # 0032cae0] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 # 0032cae0] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Cop
yright 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 de
block=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 chr
oma_qp_offset=4 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=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 scenecu
t=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.0.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv444p, 800x600 [SAR 1:1
DAR 4:3], q=-1--1, 16384 tbn, 0.20 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 2 fps=0.0 q=2621023.0 Lsize= 37kB time=00:00:10.00 bitrate= 30.0
kbits/s
video:36kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.142993%
[libx264 # 0032cae0] frame I:1 Avg QP:11.18 size: 17627
[libx264 # 0032cae0] frame P:1 Avg QP:11.45 size: 18415
[libx264 # 0032cae0] mb I I16..4: 18.3% 69.5% 12.3%
[libx264 # 0032cae0] mb P I16..4: 11.6% 60.1% 9.7% P16..4: 8.9% 6.6% 2.2%
0.0% 0.0% skip: 0.8%
[libx264 # 0032cae0] 8x8 transform intra:71.4% inter:67.1%
[libx264 # 0032cae0] coded y,u,v intra: 57.0% 24.1% 22.3% inter: 42.6% 25.7% 16.
4%
[libx264 # 0032cae0] i16 v,h,dc,p: 28% 50% 15% 8%
[libx264 # 0032cae0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 39% 28% 2% 2% 2% 3%
3% 4%
[libx264 # 0032cae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 53% 23% 1% 2% 2% 3%
0% 2%
[libx264 # 0032cae0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0032cae0] kb/s:28.83
C:\xampp\htdocs>
I think your only problem is that you're not telling ffmpeg what output format to use.
try ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 -pix_fmt yuv420p out.mp4
Also remember that the images have to be the same size. You'll need to preprocess them to the same size if they're not.
good luck

Resources