Opened 9 years ago
Last modified 3 years ago
#3789 open defect
shortest command doesnt work when using a filter_complex with audio and video filters
Reported by: | phingers | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | shortest |
Cc: | mrskman@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description (last modified by )
Summary of the bug: shortest command doesn't work when using a filter_complex with audio and video filters
I uploaded output.mp4 at 8:21 ET on 7/20/14 to upload.ffmpeg.org
The background audio is 4 mins long, but it should be truncated to the video length.
Shortest works if I take the drawtext off the filter_complex
How to reproduce:
ffmpeg -framerate 1/5 -i foo%03d.png -i audio.wav -i speak.wav -filter_complex '[1:a]volume=volume=0.2[aquiet];[aquiet][2:a]amix=inputs=2[a];[0:v]drawtext=fontsize=40:fontcolor=white@0.9:fontfile=FreeSerif.ttf:shadowy=2:shadowx=2:text="I am getting the hang of ffmpeg\!":x=(w-text_w)/2:y=(h-text_h-line_h)/2[v]' -map '[a]' -map '[v]' -shortest -r 32 -c:v libx264 -b:a 192k -pix_fmt yuv420p output.mp4 ffmpeg version 2.2.4- http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2014 the FFmpeg developers built on Jul 1 2014 22:10:48 with gcc 4.8 (Debian 4.8.3-4) configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8 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, image2, from 'foo%03d.png': Duration: 00:00:30.00, start: 0.000000, bitrate: N/A Stream #0:0: Video: png, rgb24, 640x360 [SAR 2835:2835 DAR 16:9], 0.20 fps, 1 tbr, 0.20 tbn, 0.20 tbc Input #1, mp3, from 'audio.wav': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6mp41 encoder : Lavf54.29.104 Duration: 00:04:29.09, start: 0.025057, bitrate: 238 kb/s Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 238 kb/s Guessed Channel Layout for Input Stream #2.0 : mono Input #2, wav, from 'speak.wav': Duration: 00:00:03.33, bitrate: 256 kb/s Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s File 'output.mp4' already exists. Overwrite ? [y/N] y [libx264 @ 0x2fdf7a0] using SAR=1/1 [libx264 @ 0x2fdf7a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 [libx264 @ 0x2fdf7a0] profile High, level 3.0 [libx264 @ 0x2fdf7a0] 264 - core 142 r2 a5831aa - 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=18 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 'output.mp4': Metadata: encoder : Lavf55.33.100 Stream #0:0: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 192 kb/s (default) Stream #0:1: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 16384 tbn, 32 tbc (default) Stream mapping: Stream #0:0 (png) -> drawtext Stream #1:0 (mp3) -> volume Stream #2:0 (pcm_s16le) -> amix:input1 amix -> Stream #0:0 (libvo_aacenc) drawtext -> Stream #0:1 (libx264) Press [q] to stop, [?] for help frame= 800 fps=116 q=-1.0 Lsize= 6606kB time=00:04:29.05 bitrate= 201.1kbits/s dup=794 drop=0 video:238kB audio:6307kB subtitle:0 data:0 global headers:0kB muxing overhead 0.933773% [libvo_aacenc @ 0x2fde340] 1 frames left in the queue on closing [libx264 @ 0x2fdf7a0] frame I:5 Avg QP:17.56 size: 37668 [libx264 @ 0x2fdf7a0] frame P:201 Avg QP:17.22 size: 219 [libx264 @ 0x2fdf7a0] frame B:594 Avg QP:25.96 size: 18 [libx264 @ 0x2fdf7a0] consecutive B-frames: 0.8% 0.2% 1.5% 97.5% [libx264 @ 0x2fdf7a0] mb I I16..4: 4.7% 64.5% 30.8% [libx264 @ 0x2fdf7a0] mb P I16..4: 0.1% 0.2% 0.3% P16..4: 0.5% 0.0% 0.0% 0.0% 0.0% skip:99.0% [libx264 @ 0x2fdf7a0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.1% 0.0% 0.0% direct: 0.0% skip:99.9% L0:16.4% L1:83.6% BI: 0.0% [libx264 @ 0x2fdf7a0] 8x8 transform intra:58.6% inter:30.7% [libx264 @ 0x2fdf7a0] coded y,uvDC,uvAC intra: 83.7% 87.7% 75.6% inter: 0.0% 0.1% 0.0% [libx264 @ 0x2fdf7a0] i16 v,h,dc,p: 50% 11% 7% 32% [libx264 @ 0x2fdf7a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 19% 21% 6% 6% 5% 8% 6% 13% [libx264 @ 0x2fdf7a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 22% 11% 6% 7% 6% 7% 5% 12% [libx264 @ 0x2fdf7a0] i8c dc,h,v,p: 50% 22% 20% 8% [libx264 @ 0x2fdf7a0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x2fdf7a0] ref P L0: 94.2% 0.5% 3.9% 1.4% [libx264 @ 0x2fdf7a0] ref B L0: 53.1% 45.3% 1.6% [libx264 @ 0x2fdf7a0] ref B L1: 95.1% 4.9% [libx264 @ 0x2fdf7a0] kb/s:77.80
Change History (11)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|---|
Keywords: | shortest added; complex filter removed |
Version: | 2.2.4 → git-master |
follow-up: 4 comment:2 by , 9 years ago
comment:4 by , 9 years ago
Replying to cehoyos:
Is this a regression?
It doesn't look like a regression to me. I checked it with several of the release versions including the 2.2 branch, the 2.1 branch, the 2.0 branch, the 1.2 branch and the 1.1 branch. Same results with each version.
I've also managed to simplify the command by a bit.
This is the simplest version of the command I've found so far that reproduces the issue:
ffmpeg -i file -filter_complex '[0:a]anull[a];[0:v]trim=duration=25[v]' -map '[v]' -map '[a]' -shortest output
Note that it does not matter if the audio stream is shorter or if the video stream is shorter, -shortest does not work in either case. -filter_complex - on the other hand - is required. Using:
ffmpeg -i file -af anull -vf trim=duration=25 -shortest output
does not trigger the bug.
Input file format and output file format do not seem to influence the issue nor does the codec used.
comment:5 by , 9 years ago
Confirmed, got this bug too. It just encodes infinitely. Could we have some attention to it?
comment:6 by , 9 years ago
Reproduced by developer: | set |
---|---|
Status: | new → open |
comment:7 by , 9 years ago
I can confirm the same error. I'm not using audio, but an overlay option and this is the same issue. File keeps on growing and growing.
comment:8 by , 9 years ago
Confirmed here too.
Can we finally get some dev love on this bug, please?
comment:9 by , 5 years ago
Current version has still the problem. This function is in combination with audio filter apad very useful, but sadly this bug exists.
follow-up: 11 comment:10 by , 3 years ago
Cc: | added |
---|
I had the same issue. Workaround is using separate -filter_complex argument for every output stream:
ffmpeg -i AUDIO -i VIDEO \ -filter_complex '[0:a]apad[audio]' \ -filter_complex '[0:v]scale=-2:720[video]' \ -map '[audio]' -map '[video]' \ -shortest \ OUTPUT
comment:11 by , 3 years ago
Replying to mrskman:
I had the same issue. Workaround is using separate -filter_complex argument for every output stream:
Thank You a lot. One clarification: in my case where the video is endless, the video filter should be placed first, i.e. before audio.
Is this a regression?