Sometims ffmpeg never completes, and thereby preventing conversions of other videos in the queue. Is it possible to set some sort of timeout in ffmpeg such that it terminates if it isnt finished within some given time, example 5 min
My command looks like this today:
ffmpeg -i /home/tomcat/bsafevideo/1efef9daa7f5000ed83d67f6fbd0e7d9/aad5adc307c4dd7e457509423a7f3734/69451c31cd592e86138423f6849d8141 -y -r 24 -ar 22050 -f mov -vf [in]transpose=1[rt0],[rt0]scale=iw*480/ih:480[sc0],[sc0]pad=640:480:140[pd0],movie=/srv/bsafe/tomcat7/webapps/ROOT/resources/images/logo_watermark.png [wm],[pd0][wm] overlay=W-w-140:0[out] /home/tomcat/bsafevideo/1efef9daa7f5000ed83d67f6fbd0e7d9/aad5adc307c4dd7e457509423a7f3734/69451c31cd592e86138423f6849d8141.mov -ar 22050 -b 1500k -vcodec libtheora -acodec libvorbis -f ogg -vf [in]transpose=1[rt0],[rt0]scale=iw*480/ih:480[sc0],[sc0]pad=640:480:140[pd0],movie=/srv/bsafe/tomcat7/webapps/ROOT/resources/images/logo_watermark.png [wm],[pd0][wm] overlay=W-w-140:0[out] /home/tomcat/bsafevideo/1efef9daa7f5000ed83d67f6fbd0e7d9/aad5adc307c4dd7e457509423a7f3734/69451c31cd592e86138423f6849d8141.ogg -ar 22050 -vcodec libx264 -profile baseline -vf [in]transpose=1[rt0],[rt0]scale=iw*480/ih:480[sc0],[sc0]pad=640:480:140[pd0],movie=/srv/bsafe/tomcat7/webapps/ROOT/resources/images/logo_watermark.png [wm],[pd0][wm] overlay=W-w-140:0[out] /home/tomcat/bsafevideo/1efef9daa7f5000ed83d67f6fbd0e7d9/aad5adc307c4dd7e457509423a7f3734/69451c31cd592e86138423f6849d8141_mp4.mp4
UPDATE. Thanks LordNeckBerd, you pointed me in right direction!
So I see now its kind of not ffmpeg really hanging, the issue is that my java code which reads the inputstream from the linux process will block since ffmpeg never returns a end of line, which I see now when Im running the command. This is the blocking line, it waits for more input from me.
Press [q] to stop, [?] for help
So its two issues here now. First is why this particular conversion is failing, and second, how to make sure ffmpeg is not making this (for my Java process) blocking command asking for more input.
C:\Program Files (x86)\Console2>ffmpeg -i C:/projectsGit/bsafe-server/classes/test/bs- base/video/ac7601e2bc3bc1545cd30ad3160f5232 -y -r 24 -ar 22050 -f mov C:/projectsGit/bsafe-server/classes/test/bs-base/video/ac7601e2bc3bc1545cd30ad3160f5232.mov -ar 22050 -b:v 1500k -vcodec libtheora -acodec libvorbis -f ogg C:/projectsGit/bsafe-server/classes/test/bs-base/video/ac7601e2bc3bc1545cd30ad3160f5232.ogg -ar 22050 -vcodec libx264 -profile:v baseline C:/projectsGit/bsafe-server/classes/test/bs-base/video/ac7601e2bc3bc1545cd30ad3160f5232_mp4.mp4
ffmpeg version N-54762-g38b701a Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 15 2013 18:47:20 with gcc 4.7.3 (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-libcaca --enable-libfreetype --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-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable- libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 81.101 / 3. 81.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/projectsGit/bsafe-server/classes/test/bs- base/video/ac7601e2bc3bc1545cd30ad3160f5232':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2013-01-15 05:46:02
Duration: 00:00:10.03, start: 0.000000, bitrate: 394 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 640x480, 264 kb/s, SAR 65536:65536 DAR 4:3, 10.95 fps, 90k tbr, 90k tbn, 180k tbc
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 127 kb/s
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : SoundHandle
[ogg # 00000000027d7860] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[mp4 # 00000000027dacc0] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 # 0000000003e6b9c0] using SAR=1/1
[libx264 # 0000000003e6b9c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0000000003e6b9c0] profile High, level 3.0
[libx264 # 0000000003e6b9c0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=24 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
[libx264 # 00000000027db4a0] using SAR=1/1
[libx264 # 00000000027db4a0] MB rate (108000000) > level limit (2073600)
[libx264 # 00000000027db4a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 00000000027db4a0] profile Constrained Baseline, level 5.2
[libx264 # 00000000027db4a0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 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=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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 'C:/projectsGit/bsafe-server/classes/test/bs- base/video/ac7601e2bc3bc1545cd30ad3160f5232.mov':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf55.12.102
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 12288 tbn, 24 tbc
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (libvo_aacenc) (mp4a / 0x6134706D), 22050 Hz, mono, s16, 128 kb/s
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : SoundHandle
Output #1, ogg, to 'C:/projectsGit/bsafe-server/classes/test/bs-base/video/ac7601e2bc3bc1545cd30ad3160f5232.ogg':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf55.12.102
Stream #1:0(eng): Video: theora (libtheora), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1500 kb/s, 90k tbn, 90k tbc
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : VideoHandle
Stream #1:1(eng): Audio: vorbis (libvorbis), 22050 Hz, mono, fltp
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : SoundHandle
Output #2, mp4, to 'C:/projectsGit/bsafe-server/classes/test/bs-base/video/ac7601e2bc3bc1545cd30ad3160f5232_mp4.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf55.12.102
Stream #2:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 90k tbn, 90k tbc
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : VideoHandle
Stream #2:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 22050 Hz, mono, s16, 128 kb/s
Metadata:
creation_time : 2013-01-15 05:46:02
handler_name : SoundHandle
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
Stream #0:0 -> #1:0 (h264 -> libtheora)
Stream #0:1 -> #1:1 (aac -> libvorbis)
Stream #0:0 -> #2:0 (h264 -> libx264)
Stream #0:1 -> #2:1 (aac -> libvo_aacenc)
Press [q] to stop, [?] for help
Related
I'm trying to use ffmpeg to prepare a mp4 file which is vertical recorded for upload to youtube.
(on a synology DS220+)
In the output file I want to have no black bars on the side but blured sodebars of the movie itself.
This I'm trying to do whit this code (in the end I want to automate this process, but maybe there is a better way to do this):
ffmpeg -i input.mp4 -lavfi "[0:v]scale=1920*2:1080*2,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[0:v]scale=-1:1080[ov];[bg][ov]overlay=(W-w)/2:(H-h)/2,crop=w=1920:h=1080" output.mp4
unfortunaly i get a error message :
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
In mine search on the internet I have tried multiple ways to get this done but whit all the same error result.
This was making me think that the ffmpeg install is faulty or I was trying wrong code.
Could somebody help me whit this "project"
full responce below:
username#ip:/volume1/location$ ffmpeg -i input.mp4 -lavfi "[0:v]scale=1920*2:1080*2,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[0:v]scale=-1:1080[ov];[bg][ov]overlay=(W-w)/2:(H-h)/2,crop=w=1920:h=1080" output.mp4
ffmpeg version 2.7.7 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-bzlib --disable-protocol=rtp --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffserver --disable-ffplay --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-decoder=amrnb --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=dca --disable-decoder=eac3 --disable-decoder=truehd --disable-decoder=hevc --disable-muxer=hevc --disable-demuxer=hevc --disable-parser=hevc --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ccache-gcc --enable-yasm --enable-libx264 --enable-encoder=libx264
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100
Duration: 00:00:36.12, start: 0.000000, bitrate: 2529 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709), 406x720 [SAR 405:406 DAR 9:16], 2394 kb/s, 30 fps, 30 tbr, 12k tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
File 'output.mp4' already exists. Overwrite ? [y/N] y
[libx264 # 0x1cdc4a0] using SAR=81/256
[libx264 # 0x1cdc4a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 # 0x1cdc4a0] profile High, level 4.0
[libx264 # 0x1cdc4a0] 264 - core 148 - 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=3 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 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100
Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 81:256 DAR 9:16], q=-1--1, 30 fps, 30 tbn, 30 tbc (default)
Metadata:
encoder : Lavc56.41.100 libx264
Stream #0:1(und): Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc56.41.100 libfaac
Stream mapping:
Stream #0:0 (h264) -> scale (graph 0)
Stream #0:0 (h264) -> scale (graph 0)
crop (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Your ffmpeg is from 2015 and is too old. Try upgrading using SynoCommunity.
I am trying to concatenate mp4 files into a single file. I am attempting to use the concat filter directly for reasons independent from this question (so -i list.txt is not a valid solution). All video files in question are between 4 and 20 minutes in length.
What I am executing:
% ffmpeg -i f01.mp4 -i f02.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" output.mp4
This is my understanding of the form of this command from references such as FFmpeg Filters Documentation: concat and Concatenate Videos Together Using FFMPEG!.
What happens:
ffmpeg gives a lot of output as it checks the metadata for each stream and then begins processing. After a short duration (several seconds to a minute or so, seems to be prortional to the duration of the first video) I start seeing messages like this:
More than 1000 frames duplicated
More than 10000 frames duplicated 512kB time=00:00:00.12 bitrate=32771.0kbits/s dup=33365 drop=0 speed=0.00449x
More than 100000 frames duplicated 1280kB time=00:00:00.17 bitrate=61442.1kbits/s dup=66730 drop=0 speed=0.00272x
... and then the process never completes. If I leave my computer running for 24 hours, ffmpeg is still using max available CPU (200-300%). The output file is 48 bytes in length.
Note: the inputs are only a few minutes each, so individually re-encoding the inputs would take only a few minutes each.
Note: if I change the command to use f01.mp4 for both source 0 and source 1, the command completes as expected in under 5 minutes:
% # example that works:
% # note, however, that this just repeats the same source twice
% ffmpeg -i f01.mp4 -i f01.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" output.mp4
Full output:
Here is the complete output of a run in case it's helpful:
% ffmpeg -i f01.mp4 -i f02.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" output.mp4
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_2 --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-librav1e --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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'f01.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2020-06-04T21:34:26.000000Z
encoder : HandBrake 1.3.2 2020050300
Duration: 00:04:14.66, start: 0.000000, bitrate: 525 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 708x478 [SAR 8:9 DAR 944:717], 366 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2020-06-04T21:34:26.000000Z
handler_name : VideoHandler
Stream #0:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 149 kb/s (default)
Metadata:
creation_time : 2020-06-04T21:34:26.000000Z
handler_name : Stereo
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'f02.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2020-06-04T21:38:15.000000Z
encoder : HandBrake 1.3.2 2020050300
Duration: 00:06:30.95, start: 0.000000, bitrate: 1328 kb/s
Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 708x478 [SAR 8:9 DAR 944:717], 1179 kb/s, 29.97 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2020-06-04T21:38:15.000000Z
handler_name : VideoHandler
Stream #1:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 140 kb/s (default)
Metadata:
creation_time : 2020-06-04T21:38:15.000000Z
handler_name : Stereo
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (h264) -> concat:in1:v0
Stream #1:1 (aac) -> concat:in1:a0
concat:out:v0 -> Stream #0:0 (libx264)
concat:out:a0 -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[mp4 # 0x7ff130014000] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 # 0x7ff130021200] using SAR=8/9
[libx264 # 0x7ff130021200] MB rate (1350000000) > level limit (16711680)
[libx264 # 0x7ff130021200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7ff130021200] profile High, level 6.2, 4:2:0, 8-bit
[libx264 # 0x7ff130021200] 264 - core 160 r3011 cde9a93 - 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=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 'output.mp4':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 708x478 [SAR 8:9 DAR 944:717], q=-1--1, 1000k tbn, 1000k tbc (default)
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.91.100 aac
More than 1000 frames duplicated
More than 10000 frames duplicated 512kB time=00:00:00.12 bitrate=32771.0kbits/s dup=33365 drop=0 speed=0.00449x
More than 100000 frames duplicated 1280kB time=00:00:00.17 bitrate=61442.1kbits/s dup=66730 drop=0 speed=0.00272x
frame=667333 fps=1079 q=33.0 size= 14848kB time=00:00:00.76 bitrate=158379.2kbits/s dup=667312 drop=0 speed=0.00124x
As the warning in the log says, Frame rate very high for a muxer not efficiently supporting it. This happens because concat unsets the stream frame rate, which happens when the tbr of all video streams don't match. ffmpeg will then use the time_base as the effective frame rate and then duplicate frames to match that frame rate. In this case, it's 90000, so this effectively explodes resource use and slows down the process.
Add -vsync 2 to avoid frame duplication.
ffmpeg -i f01.mp4 -i f02.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -vsync 2 -map "[v]" -map "[a]" output.mp4
how to remove duplicated frame from 00:00:00,00 to 00:00:00,25 (00frame ~ 25frames)section not overall with mpdecimate filter ??
normally H264 video have some duplicated frames on video start section ..
i have tried like this ,
1) ./ffmpeg -i cated_2-3.UMMJI.MTS -map 0:0 -c:v prores_ks -profile:v 1 -qscale:v 8 -s 1920x1080 -r 29.97 -top 1 -c:a pcm_s16le -map 0:1 -filter:a:0 "pan=mono|c0=c0" -map 0:1 -filter:a:1 "pan=mono|c0=c1" -metadata:s encoder="Apple ProRes 422 LT" -filter_complex "[0]split=2[a][b];[a]trim=end_frame=26,mpdecimate[a];[b]trim=start_frame=25,setpts=PTS-STARTPTS[b];[a][b]concat=n=2:v=1:a=0" -vsync vfr -vf blackdetect=d=0.1:pix_th=.1 cated_2-3.UMMJI_MTS_mpdecimate26_section.mov
and tried to check black_frame on out prores mov file
2)./ffmpeg -i cated_2-3.UMMJI_MTS_mpdecimate26_section.mov -vf blackdetect=d=0.1:pix_th=.1 test.mov
then , will be shown like below
macmini-master:1. two_file_test khan$ ./ffmpeg -i cated_2-3.UMMJI_MTS_mpdecimate26_section.mov -vf blackdetect=d=0.1:pix_th=.1 test.mov
ffmpeg version N-92108-ge08a876e67-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 32.100 / 58. 32.100
libavformat 58. 18.104 / 58. 18.104
libavdevice 58. 4.105 / 58. 4.105
libavfilter 7. 33.100 / 7. 33.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cated_2-3.UMMJI_MTS_mpdecimate26_section.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.18.104
Duration: 00:25:12.58, start: 0.000000, bitrate: 86198 kb/s
Stream #0:0(eng): Video: prores (apcs / 0x73637061), yuv422p10le(tv, top first), 1920x1080, 84662 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 11988 tbn, 11988 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Apple ProRes 422 LT
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, mono, s16, 768 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, mono, s16, 768 kb/s
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (prores (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 # 0x7f8eb2804200] using SAR=1/1
[libx264 # 0x7f8eb2804200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7f8eb2804200] profile High 4:2:2, level 4.0, 4:2:2, 8-bit
[libx264 # 0x7f8eb2804200] 264 - core 157 r2935 545de2f - 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, mov, to 'test.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.18.104
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.32.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.32.100 aac
frame= 8224 fps= 21 q=29.0 size= 86528kB time=00:04:34.49 bitrate=2582.3kbits/s dup=19 drop=0 speed=0.689x
as you can see duplicated frame just changed to black frame , not removed
this MTS file have 19 duplicated frames !
also i have checked in FCPX and count how many dupicated frame on out prores mov file ...
Use
ffmpeg -i in -filter_complex "[0]split=2[a][b];[a]trim=end_frame=26,mpdecimate[a];[b]trim=start_frame=26,setpts=PTS-STARTPTS[b];[a][b]concat=n=2:v=1:a=0" -vsync vfr out
FFMPEG issue that I am not familiar with. seems to only happen with this particular file. Anyone by any chance can take a look at this long out put and provide any feedback on what might actually be causing this?
ffmpeg_18.exe -i "E:\TESTFILES\115637.mov" -vcodec libx264 -b:v 700k -s 720x480 -r 29.97 -pix_fmt yuv420p -vf yadif -aspect 4:3 -acodec libvo_aacenc -b:a 96k -ar 44100 -f mp4 -y "E:\TESTFILES\test\115637.flv"
ffmpeg version N-39877-g4fa706a Copyright (c) 2000-2012 the FFmpeg developers
built on Apr 16 2012 14:53:47 with gcc 4.6.3
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-li
bnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 46.100 / 51. 46.100
libavcodec 54. 14.101 / 54. 14.101
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 70.100 / 2. 70.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'E:\TESTFILES\115637.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-05-03 20:48:28
Duration: 00:00:30.03, start: 0.000000, bitrate: 154663 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 151585 kb/s, SAR 1920:1920 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc
Metadata:
creation_time : 2018-05-03 20:48:28
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, 4 channels, s16, 3072 kb/s
Metadata:
creation_time : 2018-05-03 20:48:28
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
Metadata:
creation_time : 2018-05-03 20:51:29
handler_name : Apple Alias Data Handler
timecode : 00:00:00;00
[buffer # 035c33a0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 sar:1920/1920 sws_param:flags=2
[yadif # 01e7caa0] mode:0 parity:-1 auto_enable:0
[scale # 01e7c6a0] w:1920 h:1080 fmt:yuv420p sar:1920/1920 -> w:720 h:480 fmt:yuv420p sar:32/27 flags:0x4
[libx264 # 035b8c40] using SAR=8/9
[libx264 # 035b8c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX FMA3
[libx264 # 035b8c40] profile High, level 3.0
[libx264 # 035b8c40] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=24 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=abr mbtree=1 bitra
te=700 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libvo_aacenc # 01e7bae0] Unable to set encoding parameters
Output #0, mp4, to 'E:\TESTFILES\test\115637.flv':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-05-03 20:48:28
Stream #0:0(eng): Video: h264, yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 700 kb/s, 90k tbn, 29.97 tbc
Metadata:
creation_time : 2018-05-03 20:48:28
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: aac, 44100 Hz, 4 channels, s16, 96 kb/s
Metadata:
creation_time : 2018-05-03 20:48:28
handler_name : Apple Alias Data Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Stream #0:1 -> #0:1 (pcm_s16le -> libvo_aacenc)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Your ffmpeg is really old
You can get a recent version for Windows at Zeranoe.
libvo_aacenc is crappy
It was removed from ffmpeg years ago. Quality was bad and it could not handle more than 2 channels. Update and use the built-in AAC encoder instead:
ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -vf "yadif,scale=-2:720,format=yuv420p" -c:a aac -ac 2 -b:a 96k output.flv
This example downmixes your 4 channel input to 2 channels (stereo) with the -ac 2 option.
See FFmpeg Wiki: H.264 for video encoding info.
I need to add text to mp4 video. If I write result to file then everything is OK, but I want to read data from ffmpeg stream.
I run command:
ffmpeg -i sample.mp4 -filter_complex "drawtext='text=\"Sample Text\"':x=(w-text_w)/2:y=(h-text_h-line_h)/2:fontsize=40:fontcolor=white:fontfile=TimesNewRoman.ttf:enable='between(t,1,5)'" -f mp4 -
I received the following error:
ffmpeg version 2.2.2-tessus Copyright (c) 2000-2014 the FFmpeg developers
built on May 7 2014 23:17:42 with clang version 3.3 (tags/RELEASE_33/final)
configuration: --cc=/opt/local/bin/clang-mp-3.3 --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --enable-runtime-cpudetect
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a5732-480x320-clip01-sound.mp4':
Metadata:
major_brand : M4V
minor_version : 1
compatible_brands: M4V mp42isom
creation_time : 2014-02-12 02:23:02
Duration: 00:00:15.10, start: 0.000000, bitrate: 509 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 480x320 [SAR 1:1 DAR 3:2], 457 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2014-02-12 02:23:02
handler_name : Mainconcept MP4 Video Media Handler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, stereo, fltp, 46 kb/s (default)
Metadata:
creation_time : 2014-02-12 02:23:02
handler_name : Mainconcept MP4 Sound Media Handler
[libx264 # 0x10400d800] using SAR=1/1
[libx264 # 0x10400d800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 # 0x10400d800] profile High, level 2.1
[libx264 # 0x10400d800] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 # 0x10400d200] muxer does not support non seekable output
Output #0, mp4, to 'pipe:':
Metadata:
major_brand : M4V
minor_version : 1
compatible_brands: M4V mp42isom
encoder : Lavf55.33.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 480x320 [SAR 1:1 DAR 3:2], q=-1--1, 90k tbn, 29.97 tbc (default)
Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 32000 Hz, stereo, s16, 128 kb/s (default)
Metadata:
creation_time : 2014-02-12 02:23:02
handler_name : Mainconcept MP4 Sound Media Handler
Stream mapping:
Stream #0:0 (h264) -> drawtext (graph 0)
drawtext (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Conversion failed!
It seems the problem is related to mp4 and "muxer does not support non seekable output"
Is there a solution how to make such text adding on the fly and return video as we have data and not to wait until all file is processed.
Thanks
You can't use MP4 with STDOUT. The MP4 container requires the encoder to go back and make changes to the beginning of the file after it is done writing through the end. Since STDOUT cannot seek, outputting media in an MP4 container is not possible with STDOUT.
You can use the empty_moov example ffmpeg -y -framerate 0.5 -pattern_type glob -i '*.jpg' -f mp4 -movflags empty_moov - | ffprobe -
-movflags empty_moov
Write an initial moov atom directly at the start of the file, without describing any samples in it. Generally, an mdat/moov pair is written at the start of the file, as a normal MOV/MP4 file, containing only a short portion of the file. With this option set, there is no initial mdat atom, and the moov atom only describes the tracks but has a zero duration.
This option is implicitly set when writing ismv (Smooth Streaming) files.
https://www.ffmpeg.org/ffmpeg-formats.html
Add param
-movflags frag_keyframe+empty_moov
from: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/346#issuecomment-67299526