Turning images into videos with ffmpeg - 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

Related

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 Time Lapse from Sources with Long Frozen Tail End

My source for inputs into FFmpeg is either one AVI file or a concat of many of them. Either way my resulting timelapse file has a long tail of frames that are a repeat of a single frame. It's like a very long freeze frame is resulting on the end of my output file.
I'm on an older Mac Pro so I can't update my FFmpeg. I have a laptop that has a newer version and I get the same there as well. I'm not sure if it's because my source files are AVI or not.
ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
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
[avi # 0x7fa82080c800] sample size (1) != block align (2)
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, avi, from 'concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI':
Duration: 00:10:02.00, start: 0.000000, bitrate: 365923 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 30 tbn, 30 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, mono, s16, 512 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x7fa82082cc00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 # 0x7fa82082cc00] profile High, level 3.1
[libx264 # 0x7fa82082cc00] 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=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=16 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 : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1280x720, q=-1--1, 16 fps, 16384 tbn, 16 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: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 69 kb/s
Metadata:
encoder : Lavc58.35.100 aac
frame= 1962 fps=1.2 q=-1.0 Lsize= 136725kB time=03:24:07.00 bitrate= 91.5kbits/s dup=0 drop=365448 speed=7.41x
video:31548kB audio:103624kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.149437%
[libx264 # 0x7fa82082cc00] frame I:10 Avg QP:18.74 size: 62176
[libx264 # 0x7fa82082cc00] frame P:514 Avg QP:21.24 size: 30528
[libx264 # 0x7fa82082cc00] frame B:1438 Avg QP:22.74 size: 11121
[libx264 # 0x7fa82082cc00] consecutive B-frames: 1.4% 2.0% 2.0% 94.6%
[libx264 # 0x7fa82082cc00] mb I I16..4: 2.1% 97.2% 0.7%
[libx264 # 0x7fa82082cc00] mb P I16..4: 2.0% 33.3% 0.1% P16..4: 37.7% 12.0% 10.4% 0.0% 0.0% skip: 4.5%
[libx264 # 0x7fa82082cc00] mb B I16..4: 0.7% 11.5% 0.0% B16..8: 29.1% 4.8% 1.3% direct:12.0% skip:40.6% L0:47.5% L1:42.9% BI: 9.6%
[libx264 # 0x7fa82082cc00] 8x8 transform intra:94.3% inter:83.0%
[libx264 # 0x7fa82082cc00] coded y,uvDC,uvAC intra: 73.4% 66.7% 8.5% inter: 25.9% 46.8% 2.2%
[libx264 # 0x7fa82082cc00] i16 v,h,dc,p: 17% 33% 26% 24%
[libx264 # 0x7fa82082cc00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 23% 51% 1% 2% 1% 4% 1% 2%
[libx264 # 0x7fa82082cc00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 19% 5% 8% 7% 13% 5% 5%
[libx264 # 0x7fa82082cc00] i8c dc,h,v,p: 46% 29% 23% 2%
[libx264 # 0x7fa82082cc00] Weighted P-Frames: Y:47.5% UV:19.3%
[libx264 # 0x7fa82082cc00] ref P L0: 45.0% 13.8% 20.6% 15.7% 5.0%
[libx264 # 0x7fa82082cc00] ref B L0: 61.1% 30.4% 8.5%
[libx264 # 0x7fa82082cc00] ref B L1: 85.8% 14.2%
[libx264 # 0x7fa82082cc00] kb/s:2107.54
[aac # 0x7fa82081ea00] Qavg: 130.084
I've read this thread and tried to follow it:
Create time lapse video from other video
Here are some trials I've attempted before, all with the same output:
# ffmpeg -y -i $mov -vf framestep=10,setpts=N/FRAME_RATE/TB,fps=2 -r 30 $out
# ffmpeg -y -i $mov -vf framestep=10,setpts=.01*PTS -r 30 $out
# ffmpeg -y -i $mov -vf framestep=10,setpts=.1*PTS -r 30 $out
# ffmpeg -y -i "concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI" -vf framestep=10,setpts=.05*PTS -r 30 $out
ffmpeg -y -i "concat:16460001.AVI|16460002.AVI|16460003.AVI|16460004.AVI|16460005.AVI|16460006.AVI|16460007.AVI|16460008.AVI|16460009.AVI|16460010.AVI|16460011.AVI|16460012.AVI|16460013.AVI|16460014.AVI|16460015.AVI|16460016.AVI|16460017.AVI|16460018.AVI|16460019.AVI|16460020.AVI|16460021.AVI" -r 16 -filter:v "setpts=0.01*PTS" out.mp4
Am I overlooking something? I'm trying to speed up the inputs into a single file to quickly review incoming security footage. How can I do this without the super long useless tail at the end?
Use
ffmpeg -i 16460021.AVI -vf framestep=15,setpts=N/30/TB -r 30 -an out.mp4
I get an output 1/15th the length of the original. When using framestep=X, setpts should be of the form N/X/TB if you wish to avoid frame duplication. Don't use fps when compressing video duration as it uses old stream duration from before compression (a bug). Skip audio, since that will result in original length.

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

Images to video in Prezi format

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.

Ffmpeg generated movie (png -> mp4) has no video

I have a whole bunch of png's which I would like to convert into a mp4 video.
I am using the following command to stich them together:
ffmpeg -i _2016-04-20_14-51-00-500_%06d.png -pix_fmt yuv420p movie.mp4
I am getting a file, which has a size so it isn't empty. But when I play it in VLC or Quicktime it shows the time going by, but it has no video in it. Any idea what I'm doing wrong?
I also tried:
ffmpeg -framerate 1/5 -i _2016-04-20_14-51-00-500_%06d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
and
ffmpeg -r 45 -f image2 -s 1920x1080 -i _2016-04-20_14-51-00-500_%06d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4
But still no video.
This is the commandline output:
>ffmpeg -i _2016-04-20_14-51-00-500_%06d.png -pix_fmt yuv420p movie.mp4
ffmpeg version N-79546-g13406b6 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.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-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 22.100 / 55. 22.100
libavcodec 57. 35.100 / 57. 35.100
libavformat 57. 34.102 / 57. 34.102
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, image2, from '_2016-04-20_14-51-00-500_%06d.png':
Duration: 00:00:02.60, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 8192x4096 [SAR 3779:3779 DAR 2:1], 25 tbr, 25 tbn
[libx264 # 00000000025851e0] using SAR=1/1
[libx264 # 00000000025851e0] frame MB size (512x256) > level limit (36864)
[libx264 # 00000000025851e0] DPB size (4 frames, 524288 mbs) > level limit (1 frames, 184320 mbs)
[libx264 # 00000000025851e0] MB rate (3276800) > level limit (2073600)
[libx264 # 00000000025851e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 00000000025851e0] profile High, level 5.2
[libx264 # 00000000025851e0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=18 lookahead_threads=3 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
[mp4 # 0000000002583fc0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'movie.mp4':
Metadata:
encoder : Lavf57.34.102
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 8192x4096 [SAR 1:1 DAR 2:1], q=2-31, 25 fps, 12800 tbn
Metadata:
encoder : Lavc57.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 65 fps=3.2 q=-1.0 Lsize= 13498kB time=00:00:02.48 bitrate=44585.2kbits/s speed=0.123x 6x
video:13497kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009971%
[libx264 # 00000000025851e0] frame I:1 Avg QP:16.71 size:1373751
[libx264 # 00000000025851e0] frame P:52 Avg QP:23.59 size:234822
[libx264 # 00000000025851e0] frame B:12 Avg QP:21.17 size: 19609
[libx264 # 00000000025851e0] consecutive B-frames: 73.8% 3.1% 4.6% 18.5%
[libx264 # 00000000025851e0] mb I I16..4: 14.7% 73.8% 11.5%
[libx264 # 00000000025851e0] mb P I16..4: 3.1% 5.9% 0.5% P16..4: 23.2% 7.7% 2.0% 0.0% 0.0% skip:57.5%
[libx264 # 00000000025851e0] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 9.0% 0.2% 0.0% direct: 0.2% skip:90.3% L0:33.0% L1:66.6% BI: 0.4%
[libx264 # 00000000025851e0] 8x8 transform intra:63.5% inter:78.5%
[libx264 # 00000000025851e0] coded y,uvDC,uvAC intra: 33.7% 3.1% 1.0% inter: 10.1% 0.4% 0.0%
[libx264 # 00000000025851e0] i16 v,h,dc,p: 24% 57% 3% 17%
[libx264 # 00000000025851e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 31% 38% 2% 3% 2% 5% 2% 4%
[libx264 # 00000000025851e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 63% 10% 2% 2% 1% 5% 1% 4%
[libx264 # 00000000025851e0] i8c dc,h,v,p: 94% 2% 3% 0%
[libx264 # 00000000025851e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 00000000025851e0] ref P L0: 71.6% 13.1% 10.8% 4.4%
[libx264 # 00000000025851e0] ref B L0: 69.0% 30.6% 0.4%
[libx264 # 00000000025851e0] ref B L1: 89.7% 10.3%
[libx264 # 00000000025851e0] kb/s:42522.38
I tried with the following command and it works. The command is
ffmpeg -framerate 1 -f image2 -i img%06d.png -r 25 -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4
-framerate 1: An image have 1s in the resultant video
-r 25: The framerate of the resultant video
-crf 25: quality of the resultant video (if you want it to get better, take a less value - but it is advice not to go under 18)
An ensure that your images are well numbered (img000001.png, ... img000009.png, img000010.png -> img%06d.png)

Resources