I working on a programmatic sketch to cut, crop and fade in/out audio from a single input video file.
Everything works pretty well except for the audio fade in fade out.
Everything work fine if I set a fade in and fade out time of 1 (or more) seconds. Here's my command:
ffmpeg -ss 0:1:11.10 -i INPUT_FILE.mp4 -filter:a afade=t=in:st=0:d=1.0,afade=t=out:st=55.867:d=1.0 -filter:v crop=720:720:138:0 -to 0:0:56.86 OUTPUT_FILE.mp4
Fade filter stop working if I set time less than 1 secs (say 100ms like the following example).
ffmpeg -ss 0:1:11.10 -i INPUT_FILE.mp4 -filter:a afade=t=in:st=0:d=0.1,afade=t=out:st=56.767:d=0.1 -filter:v crop=720:720:138:0 -to 0:0:56.86 OUTPUT_FILE.mov
I mean, ffmpeg is not complaining about any error but the output video file simply has no fade in or fade out.
Why?
What I'm doing wrong?
Thank you so much for your support
Edit 22/07/2020:
here's the output from the second command:
ffmpeg -ss 0:1:11.10 -i 2020-07-20_00-13-35.mkv -filter:a afade=t=in:st=0:d=0.1,afade=t=out:st=56.767:d=0.1 -filter:v crop=720:720:138:0 -to 0:0:56.86 ./_selections/2020-07-20_00-13-35_R1_crop2_w_fadein_fadeout_0:1:11.10.mov
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --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
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --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 --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
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, matroska,webm, from '2020-07-20_00-13-35.mkv':
Metadata:
ENCODER : Lavf57.83.100
Duration: 00:03:19.23, start: 0.000000, bitrate: 2661 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1440x900, 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
Metadata:
DURATION : 00:03:19.233000000
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
title : audio desktop
DURATION : 00:03:19.065000000
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x564dad2f9680] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x564dad2f9680] profile High, level 3.1
[libx264 # 0x564dad2f9680] 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=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, mov, to './_selections/2020-07-20_00-13-35_R1_crop2_w_fadein_fadeout_0:1:11.10.mov':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x720, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
DURATION : 00:03:19.233000000
encoder : Lavc57.107.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), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
title : audio desktop
DURATION : 00:03:19.065000000
encoder : Lavc57.107.100 aac
frame= 1706 fps=140 q=-1.0 Lsize= 2685kB time=00:00:56.86 bitrate= 386.7kbits/s speed=4.67x
video:1681kB audio:942kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.351145%
[libx264 # 0x564dad2f9680] frame I:7 Avg QP:15.76 size: 60653
[libx264 # 0x564dad2f9680] frame P:448 Avg QP:23.13 size: 1372
[libx264 # 0x564dad2f9680] frame B:1251 Avg QP:31.17 size: 545
[libx264 # 0x564dad2f9680] consecutive B-frames: 1.3% 2.3% 1.4% 95.0%
[libx264 # 0x564dad2f9680] mb I I16..4: 29.2% 37.7% 33.1%
[libx264 # 0x564dad2f9680] mb P I16..4: 0.1% 0.4% 0.5% P16..4: 2.1% 0.2% 0.2% 0.0% 0.0% skip:96.4%
[libx264 # 0x564dad2f9680] mb B I16..4: 0.0% 0.3% 0.2% B16..8: 1.5% 0.1% 0.1% direct: 0.0% skip:97.8% L0:51.7% L1:46.3% BI: 2.0%
[libx264 # 0x564dad2f9680] 8x8 transform intra:43.2% inter:27.7%
[libx264 # 0x564dad2f9680] coded y,uvDC,uvAC intra: 35.4% 42.2% 40.1% inter: 0.3% 0.5% 0.3%
[libx264 # 0x564dad2f9680] i16 v,h,dc,p: 61% 37% 2% 0%
[libx264 # 0x564dad2f9680] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 7% 59% 2% 0% 0% 0% 1% 1%
[libx264 # 0x564dad2f9680] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 17% 25% 10% 4% 5% 5% 7% 7%
[libx264 # 0x564dad2f9680] i8c dc,h,v,p: 66% 19% 7% 7%
[libx264 # 0x564dad2f9680] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x564dad2f9680] ref P L0: 65.1% 15.3% 13.6% 5.9%
[libx264 # 0x564dad2f9680] ref B L0: 68.1% 27.1% 4.8%
[libx264 # 0x564dad2f9680] ref B L1: 95.3% 4.7%
[libx264 # 0x564dad2f9680] kb/s:242.09
[aac # 0x564dad2f25a0] Qavg: 606.451
Related
I'm trying to concatenate a bunch of png files into one mp4 file using ffmpeg. I use following command:
ffmpeg -f concat -i concat.txt -f mp4 out.mp4
The "description file" (concat.txt) looks like this:
file screen_001.png
duration 0.14538311958312988
file screen_002.png
duration 0.11382007598876953
file screen_003.png
duration 2.543360710144043
...
file screen_036.png
duration 0.15303301811218262
file screen_037.png
duration 0.160630464553833
file screen_038.png
duration 3.2751874923706055
Given command works, I'm able to create desired mp4 file. The problem is, the duration of the output file is smaller than sum of the duration lines from concat.txt. I expect mp4 file ~22.48s long but I get 19.20s long file.
What am I doing wrong? Maybe I'm not using some flag I should? Is it even possible to do what I want? I'm kind a newbie with ffmpeg and video manipulation at all so any help would be appreciated.
Output of the ffmpeg, maybe will be useful:
root#65181939e08e:/files/tmp# ffmpeg -f concat -i concat.txt -f mp4 out.mp4
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --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-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, concat, from 'concat.txt':
Duration: 00:00:22.48, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: png, rgba(pc), 1366x768, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x5651f1a6e8c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x5651f1a6e8c0] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
[libx264 # 0x5651f1a6e8c0] 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=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=4 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 'out.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1366x768, 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
frame= 483 fps=199 q=-1.0 Lsize= 258kB time=00:00:19.20 bitrate= 110.2kbits/s dup=445 drop=0 speed=7.89x
video:252kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.564829%
[libx264 # 0x5651f1a6e8c0] frame I:5 Avg QP: 7.86 size: 28761
[libx264 # 0x5651f1a6e8c0] frame P:121 Avg QP:14.58 size: 729
[libx264 # 0x5651f1a6e8c0] frame B:357 Avg QP:13.34 size: 70
[libx264 # 0x5651f1a6e8c0] consecutive B-frames: 1.2% 0.0% 1.9% 96.9%
[libx264 # 0x5651f1a6e8c0] mb I I16..4: 88.2% 0.0% 11.8%
[libx264 # 0x5651f1a6e8c0] mb P I16..4: 1.3% 0.0% 0.3% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:98.1%
[libx264 # 0x5651f1a6e8c0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.9% 0.0% 0.0% direct: 0.0% skip:99.1% L0:59.4% L1:40.6% BI: 0.0%
[libx264 # 0x5651f1a6e8c0] coded y,u,v intra: 7.9% 0.7% 1.3% inter: 0.0% 0.0% 0.0%
[libx264 # 0x5651f1a6e8c0] i16 v,h,dc,p: 81% 18% 1% 0%
[libx264 # 0x5651f1a6e8c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 28% 22% 2% 3% 3% 3% 3% 3%
[libx264 # 0x5651f1a6e8c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x5651f1a6e8c0] ref P L0: 72.5% 11.9% 12.4% 3.1%
[libx264 # 0x5651f1a6e8c0] ref B L0: 50.4% 48.1% 1.4%
[libx264 # 0x5651f1a6e8c0] ref B L1: 98.9% 1.1%
[libx264 # 0x5651f1a6e8c0] kb/s:106.45
Thanks for your help!
Create a video from each png like this:
ffmpeg -f image2 -loop 1 -i 01.png -r 30 -t 00:00:05.000 -pix_fmt yuv420p 01.mp4
Where:
"-r 30" is frame rate
"-t 00:00:05.000" is the time of this PNG in the video, in this case 5 seconds, looking this the floating point is 3 :(
Anyway, make this for each video and to concat it, create a txt:
concat.txt
file '01.mp4'
file '02.mp4'
And use ffmpeg to concat all files
ffmpeg -f concat -safe 0 -i concat.txt -c copy output.mp4
Good luck!
Edit in the docs are in microseconds too, maybe float point is 6 and not 3:
http://www.ffmpeg.org/ffmpeg-utils.html#time-duration-syntax
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.
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 have been doing screen-only (no sound) capture using ffmpeg with libx264 for the encoding quite successfully on an old machine built around a Core2 Quad Q6600 processor. I now need to include audio in this, but the fans on this ancient machine are too loud. So, I found a fanless motherboard (https://www.asrock.com/mb/Intel/J5005-ITX/index.asp) that has an Intel Pentium Silver J5005 processor and decided to use this instead. The CPU's benchmarks put it in a similar bracket to the Q6600, and the general performance seems to be significantly better, presumably at least in part because it's now using DDR4 memory that's faster access.
However, the machine fails horribly at the screen capture. It's missing frames all over the place; I actually end up with video that's missing almost half the frames, and plays back at about double speed. Also, any audio is just messed up so badly I can hardly think how to describe it, best I can come up with is that I get perhaps a quarter second of sound then a few seconds pause (the video meanwhile is actually still playing back, albeit with no sense of time).
Some things occur to me that might be the cause, or cure, of my troubles, some of which I might be able to fix, others not so much. What other things should I try? (I'd prefer to avoid simply throwing money at the issue with random ideas that are baseless!)
1) perhaps the CPU lacks some "extensions" to the instruction set (I recall years ago some CPUs gaining MMX extensions") so that the CPU is fast at mundane computing but sucks at video encoding.
2) perhaps the fact that the old machine had a dedicated graphics card, while this new one is sharing main memory with the graphics system means that reading the screen pixels is much slower.
3) perhaps the fact that this new machine has a single DDR4 memory stick in it means that I'm forcing all the memory reads and writes for the computations through the same memory as is holding the screen, and that's too much (implying that adding an additional memory stick might jus possibly help?)
4) perhaps there's some bios setting that would allow more efficient sharing of video memory?
5) my favorite, perhaps there's a better compression library that I could use to get decent quality screen capture with much less CPU usage.
I should also note that I have tried this with -threads 0, and the CPU usage hovers between 100% and 200%; around 100% when the screen is static, and rising as I move windows around and otherwise create more output.
6) the motherboard claims to have some kind of hardware video encoder built into it. I haven't paid this any attention to this point, as I assumed it was for the purpose of taking HDMI input and encoding it, but maybe there's a way to use this, if so, what libraries might I need to get ffmpeg to do this.
Edits:
This is an off the shelf ffmpeg. I'm certainly willing to try building it myself if I have some idea what I should do different.
The motherboard claims to have hardware encoders, but I'm struggling to find out what they are (seems like it's an Intel chip called "UHD Graphics 605" but nothing I can find suggests ffmpeg can work with that)
command line right now has been (without audio):
ffmpeg -video_size 1280x720 -f x11grab -i ${DISPLAY}+100,100 -vcodec libx264 -f alsa -i pulse -acodec ac3 -threads 0 ./video$(date +%F-%H-%M-%S).mp4
Log from a short recording session is:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --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
[x11grab # 0x561a723e5ac0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0+100,100':
Duration: N/A, start: 1578693116.465807, bitrate: N/A
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
Unknown decoder 'libx264'
simon#studio:~$ ffmpeg -video_size 1280x720 -f x11grab -i ${DISPLAY}+100,100 -vcodec libx264 -threads 0 ./video$(date +%F-%H-%M-%S).mp4
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --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
[x11grab # 0x558225bc29a0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0+100,100':
Duration: N/A, start: 1578693132.513351, bitrate: N/A
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1280x720, 29.97 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x558225bcd360] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 # 0x558225bcd360] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 # 0x558225bcd360] 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=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=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 './video2020-01-10-14-52-12.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1280x720, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Past duration 0.806847 too large 256kB time=00:00:00.43 bitrate=4835.3kbits/s dup=16 drop=0 speed=0.207x
frame= 371 fps= 29 q=-1.0 Lsize= 639kB time=00:00:12.27 bitrate= 426.6kbits/s dup=16 drop=14 speed=0.971x
video:634kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.813096%
[libx264 # 0x558225bcd360] frame I:2 Avg QP:18.16 size:221502
[libx264 # 0x558225bcd360] frame P:93 Avg QP:14.97 size: 2007
[libx264 # 0x558225bcd360] frame B:276 Avg QP:20.13 size: 69
[libx264 # 0x558225bcd360] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 # 0x558225bcd360] mb I I16..4: 44.6% 0.0% 55.4%
[libx264 # 0x558225bcd360] mb P I16..4: 0.2% 0.0% 0.3% P16..4: 0.7% 0.1% 0.1% 0.0% 0.0% skip:98.5%
[libx264 # 0x558225bcd360] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 1.0% 0.0% 0.0% direct: 0.0% skip:99.0% L0:50.9% L1:49.0% BI: 0.1%
[libx264 # 0x558225bcd360] coded y,u,v intra: 41.3% 37.5% 37.4% inter: 0.1% 0.0% 0.0%
[libx264 # 0x558225bcd360] i16 v,h,dc,p: 58% 41% 1% 0%
[libx264 # 0x558225bcd360] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 30% 14% 2% 4% 4% 5% 3% 5%
[libx264 # 0x558225bcd360] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x558225bcd360] ref P L0: 59.2% 8.8% 25.5% 6.5%
[libx264 # 0x558225bcd360] ref B L0: 59.4% 39.0% 1.6%
[libx264 # 0x558225bcd360] ref B L1: 96.5% 3.5%
[libx264 # 0x558225bcd360] kb/s:419.29
Exiting normally, received signal 2.
Version information
fluent-ffmpeg version: 2.1.2
ffmpeg version: 3.4.2
OS: Windows 10
Code to reproduce
ffmpeg('C:/path/to/list.txt').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');
list.txt:
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
file 'C:/path/to/chunk03.ts'
file 'C:/path/to/chunk04.ts'
Note: I've tried both absolute and relative paths, with the same result.
Expected results
A video file at C:/path/to/out.mp4 that matches the 4 files in list.txt, concatenated end-to-end.
Observed results
An empty file at C:/path/to/out.mp4 with 0 duration and only 15kB in size. No errors were thrown.
This is the command that I'm trying to duplicate (it works as expected, with relative paths in list.txt):
C:/path/to> ffmpeg -f concat -i list.txt -c copy out.ts
stdout & stderr
stdout was empty. stderr is copied below (with file names modified to match the ones above):
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
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
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, tty, from 'C:/path/to/list.txt':
Duration: 00:00:00.08, bitrate: 42 kb/s
Stream #0:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (ansi) -> concat
concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 # 000001e385b45040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 000001e385b45040] profile High 4:4:4 Predictive, level 3.0, 4:4:4 8-bit
[libx264 # 000001e385b45040] 264 - core 155 r2901 7d0ff22 - 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=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=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 'C:/path/to/out.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 640x400, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 2 fps=0.0 q=-1.0 Lsize= 15kB time=00:00:00.04 bitrate=3099.0kbits/s speed=1.55x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.619430%
[libx264 # 000001e385b45040] frame I:1 Avg QP:12.71 size: 8083
[libx264 # 000001e385b45040] frame P:1 Avg QP:29.71 size: 5928
[libx264 # 000001e385b45040] mb I I16..4: 87.9% 0.0% 12.1%
[libx264 # 000001e385b45040] mb P I16..4: 9.3% 0.0% 0.0% P16..4: 0.4% 0.0% 0.0% 0.0% 0.0% skip:90.3%
[libx264 # 000001e385b45040] coded y,u,v intra: 17.9% 0.0% 0.0% inter: 0.1% 0.0% 0.0%
[libx264 # 000001e385b45040] i16 v,h,dc,p: 88% 8% 4% 0%
[libx264 # 000001e385b45040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 31% 19% 3% 2% 3% 7% 4% 3%
[libx264 # 000001e385b45040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 000001e385b45040] kb/s:1401.10
Add ffconcat version 1.0 to the start of your text file i.e.
ffconcat version 1.0
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
...
Alternatively, this is the modified cmd with the existing text file, but I'm not well-acquainted with fluent-ffmpeg.
ffmpeg('C:/path/to/list.txt').inputFormat('concat').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');