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
Related
I'm using this code to create a timelapse from a directory of images. My directory has about 1600 jpgs in it that all start with the date in this format 2020-03-01-time.jpg, 2020-03-02-time-name.jpg, etc. Sorting alphabetically works just fine. It runs, but it seems to only get through a few hundred photos and makes a 3 second long mp4. I'm not sure what I'm doing wrong.
I'm not opposed to moving to python or anything else. Eventually I'll need to pass some parameters in here and I'll attempt to automate it and ftp the output to a webserver.
Here is the command:
ffmpeg -r 24 -pattern_type glob -i '*.jpg' -s hd1080 -vcodec libx264 timelapse.mp4
Here is the output:
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, image2, from '*.jpg':
Duration: 00:01:06.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'timelapse.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x55a43cfb1d00] using SAR=1/1
[libx264 # 0x55a43cfb1d00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x55a43cfb1d00] profile High, level 4.0
[libx264 # 0x55a43cfb1d00] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=20 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 'timelapse.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 20 fps, 10240 tbn, 20 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 72 fps= 11 q=-1.0 Lsize= 10663kB time=00:00:03.45 bitrate=25318.0kbits/s speed=0.507x
video:10661kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.015737%
[libx264 # 0x55a43cfb1d00] frame I:5 Avg QP:23.69 size:223467
[libx264 # 0x55a43cfb1d00] frame P:33 Avg QP:26.52 size:139314
[libx264 # 0x55a43cfb1d00] frame B:34 Avg QP:28.49 size:152989
[libx264 # 0x55a43cfb1d00] consecutive B-frames: 33.3% 8.3% 8.3% 50.0%
[libx264 # 0x55a43cfb1d00] mb I I16..4: 2.2% 96.6% 1.2%
[libx264 # 0x55a43cfb1d00] mb P I16..4: 2.1% 78.8% 1.5% P16..4: 9.4% 4.7% 2.6% 0.0% 0.0% skip: 0.8%
[libx264 # 0x55a43cfb1d00] mb B I16..4: 1.1% 20.4% 2.3% B16..8: 27.6% 13.7% 5.3% direct:22.7% skip: 6.9% L0:33.5% L1:32.2% BI:34.3%
[libx264 # 0x55a43cfb1d00] 8x8 transform intra:93.8% inter:86.5%
[libx264 # 0x55a43cfb1d00] coded y,uvDC,uvAC intra: 91.5% 66.0% 17.4% inter: 77.7% 58.7% 2.2%
[libx264 # 0x55a43cfb1d00] i16 v,h,dc,p: 13% 56% 3% 28%
[libx264 # 0x55a43cfb1d00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 20% 39% 4% 3% 3% 4% 4% 8%
[libx264 # 0x55a43cfb1d00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 28% 12% 5% 7% 7% 6% 7% 8%
[libx264 # 0x55a43cfb1d00] i8c dc,h,v,p: 49% 29% 19% 3%
[libx264 # 0x55a43cfb1d00] Weighted P-Frames: Y:30.3% UV:24.2%
[libx264 # 0x55a43cfb1d00] ref P L0: 48.2% 17.7% 17.7% 13.3% 3.2%
[libx264 # 0x55a43cfb1d00] ref B L0: 83.2% 14.2% 2.5%
[libx264 # 0x55a43cfb1d00] ref B L1: 93.8% 6.2%
[libx264 # 0x55a43cfb1d00] kb/s:24258.47
I am following these instructions regarding capturing and converting video from a Wear OS device, and I am running into problems. I get a video and I can tell it is my screen but it seems to be warped. This should be a green check with some white text.
There is a lot of noise when I run this:
ffmpeg -f rawvideo -vcodec rawvideo -s 400x400 -pix_fmt rgb24 -r 10 -i video.raw -an -c:v libx264 -pix_fmt yuv420p video.mp4
Here
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.62)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --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-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[rawvideo # 0x7fbcec008200] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'video.raw':
Duration: 00:00:07.00, start: 0.000000, bitrate: 38566 kb/s
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 400x400, 38400 kb/s, 10 tbr, 10 tbn, 10 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x7fbce980d400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7fbce980d400] profile High, level 2.1, 4:2:0, 8-bit
[libx264 # 0x7fbce980d400] 264 - core 159 r2999 296494a - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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=10 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 : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 400x400, q=-1--1, 10 fps, 10240 tbn, 10 tbc
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[rawvideo # 0x7fbcec008200] Packet corrupt (stream = 0, dts = 70).
video.raw: corrupt input packet in stream 0
[rawvideo # 0x7fbce980c800] Invalid buffer size, packet size 145920 < expected frame_size 480000
Error while decoding stream #0:0: Invalid argument
frame= 70 fps=0.0 q=-1.0 Lsize= 90kB time=00:00:06.70 bitrate= 110.3kbits/s speed=46.5x
video:89kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.788509%
[libx264 # 0x7fbce980d400] frame I:4 Avg QP:15.11 size: 8077
[libx264 # 0x7fbce980d400] frame P:26 Avg QP:12.39 size: 2159
[libx264 # 0x7fbce980d400] frame B:40 Avg QP: 9.83 size: 40
[libx264 # 0x7fbce980d400] consecutive B-frames: 21.4% 5.7% 4.3% 68.6%
[libx264 # 0x7fbce980d400] mb I I16..4: 53.0% 3.3% 43.6%
[libx264 # 0x7fbce980d400] mb P I16..4: 9.2% 2.0% 11.1% P16..4: 2.4% 1.3% 0.3% 0.0% 0.0% skip:73.7%
[libx264 # 0x7fbce980d400] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 1.5% 0.0% 0.0% direct: 0.1% skip:98.4% L0:24.1% L1:75.9% BI: 0.0%
[libx264 # 0x7fbce980d400] 8x8 transform intra:6.5% inter:9.8%
[libx264 # 0x7fbce980d400] coded y,uvDC,uvAC intra: 26.1% 44.1% 43.9% inter: 0.3% 0.8% 0.7%
[libx264 # 0x7fbce980d400] i16 v,h,dc,p: 89% 5% 5% 0%
[libx264 # 0x7fbce980d400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 22% 67% 0% 0% 0% 0% 0% 1%
[libx264 # 0x7fbce980d400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 69% 10% 0% 1% 0% 5% 0% 1%
[libx264 # 0x7fbce980d400] i8c dc,h,v,p: 59% 41% 0% 0%
[libx264 # 0x7fbce980d400] Weighted P-Frames: Y:30.8% UV:30.8%
[libx264 # 0x7fbce980d400] ref P L0: 83.0% 3.1% 13.0% 0.5% 0.5%
[libx264 # 0x7fbce980d400] kb/s:102.92
Any ideas?
I'm simply trying to put some images together into a video with specific durations. I'm using the command
ffmpeg -f concat -i concat.txt -r 30 video.mp4
# concat.txt
file capture12.png
duration 1
file capture57.png
duration 3
file capture156.png
duration 7
file capture234.png
duration 5
file capture272.png
duration 3
The output of my console is
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, concat, from 'concat.txt':
Duration: 00:00:19.00, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: png, rgba(pc), 983x553, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 000001b3e55c5c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001b3e55c5c80] profile High 4:4:4 Predictive, level 3.1, 4:4:4, 8-bit
[libx264 # 000001b3e55c5c80] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=4 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 'video.mp4':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 983x553, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 629 fps=400 q=-1.0 Lsize= 124kB time=00:00:20.86 bitrate= 48.8kbits/s dup=624 drop=0 speed=13.3x
video:116kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.050883%
[libx264 # 000001b3e55c5c80] frame I:3 Avg QP:13.09 size: 20222
[libx264 # 000001b3e55c5c80] frame P:158 Avg QP:10.80 size: 207
[libx264 # 000001b3e55c5c80] frame B:468 Avg QP:13.75 size: 53
[libx264 # 000001b3e55c5c80] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 # 000001b3e55c5c80] mb I I16..4: 23.0% 58.6% 18.4%
[libx264 # 000001b3e55c5c80] mb P I16..4: 0.0% 0.0% 0.2% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip:99.7%
[libx264 # 000001b3e55c5c80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 1.3% 0.0% 0.0% direct: 0.0% skip:98.7% L0:66.5% L1:33.5% BI: 0.0%
[libx264 # 000001b3e55c5c80] 8x8 transform intra:54.0% inter:7.4%
[libx264 # 000001b3e55c5c80] coded y,u,v intra: 15.3% 0.7% 0.7% inter: 0.0% 0.0% 0.0%
[libx264 # 000001b3e55c5c80] i16 v,h,dc,p: 86% 14% 0% 0%
[libx264 # 000001b3e55c5c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 65% 7% 28% 0% 0% 0% 0% 0% 0%
[libx264 # 000001b3e55c5c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50% 14% 14% 3% 4% 5% 4% 4% 3%
[libx264 # 000001b3e55c5c80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 000001b3e55c5c80] ref P L0: 87.3% 6.3% 5.6% 0.8%
[libx264 # 000001b3e55c5c80] ref B L0: 45.3% 54.3% 0.4%
[libx264 # 000001b3e55c5c80] ref B L1: 99.6% 0.4%
[libx264 # 000001b3e55c5c80] kb/s:45.07
I can see it clearly saying Duration 00:00:19.00 (as it should be) and then later saying that the final video is 00:00:20.86. How do I get these numbers to match?
When forming a video from a list of images, -r is not reliable.
You'll have to make two changes:
duplicate the last image entry in the concat list,
# concat.txt
file capture12.png
duration 1
file capture57.png
duration 3
file capture156.png
duration 7
file capture234.png
duration 5
file capture272.png
duration 3
file capture272.png
and use the fps filter to change framerate.
ffmpeg -f concat -i concat.txt -vf fps=30 video.mp4
I wanted to create an .mp4 video with a framerate of 1 fps out of 10 images. I followed https://trac.ffmpeg.org/wiki/Slideshow and got to (my images are in the folder I am running the command from and are name img000.png, img001.png, etc.)
path_to_ffmpeg\ffmpeg.exe -framerate 1 -i img%03d.png output.mp4
However only the first image is taken to the video and it only shows one image!
After trying multiple permutations of -framerate and -r options and positions of the options, I did not recieve any better results.
Does anyone know what might have gone wrong even in this simple case? Thanks.
Full log:
C:\Users\foo\Documents\path>C:\bar\ffmpeg-4.0.2-win64-static\bin\ffmpeg.ex
e -framerate 1 -i img%03d.png output.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.1 (GCC) 20180722
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
le-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, image2, from 'img%03d.png':
Duration: 00:00:10.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 959x550 [SAR 2834:2834 DAR 959:550], 1 fp
s, 1 tbr, 1 tbn, 1 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0000000000611040] using SAR=1/1
[libx264 # 0000000000611040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 # 0000000000611040] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-b
it
[libx264 # 0000000000611040] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 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_pski
p=1 chroma_qp_offset=4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 deci
mate=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 : Lavf58.12.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 959x550 [SA
R 1:1 DAR 959:550], q=-1--1, 1 fps, 16384 tbn, 1 tbc
Metadata:
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 10 fps=0.0 q=-1.0 Lsize= 20kB time=00:00:07.00 bitrate= 23.1kbits
/s speed=68.6x
video:19kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ov
erhead: 5.046419%
[libx264 # 0000000000611040] frame I:1 Avg QP: 4.41 size: 14084
[libx264 # 0000000000611040] frame P:3 Avg QP:12.31 size: 632
[libx264 # 0000000000611040] frame B:6 Avg QP:19.11 size: 436
[libx264 # 0000000000611040] consecutive B-frames: 20.0% 0.0% 0.0% 80.0%
[libx264 # 0000000000611040] mb I I16..4: 89.7% 0.0% 10.3%
[libx264 # 0000000000611040] mb P I16..4: 0.2% 0.0% 0.1% P16..4: 0.5% 0.1
% 0.1% 0.0% 0.0% skip:98.9%
[libx264 # 0000000000611040] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.6% 0.1
% 0.1% direct: 0.0% skip:99.1% L0:22.0% L1:73.7% BI: 4.3%
[libx264 # 0000000000611040] coded y,u,v intra: 6.1% 2.5% 2.6% inter: 0.2% 0.1%
0.1%
[libx264 # 0000000000611040] i16 v,h,dc,p: 72% 25% 3% 0%
[libx264 # 0000000000611040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 31% 20% 2% 2%
2% 3% 5% 2%
[libx264 # 0000000000611040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0000000000611040] ref P L0: 65.8% 1.5% 26.5% 6.1%
[libx264 # 0000000000611040] ref B L0: 77.0% 12.7% 10.3%
[libx264 # 0000000000611040] ref B L1: 88.6% 11.4%
[libx264 # 0000000000611040] kb/s:14.87
Older versions of VLC couldn't play videos with framerates 5 or lower. Add -r 6 to correct for that. Also, you may want to add -pix_fmt yuv420p for wide playback compatibility.
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.