[FFmpeg-user] Can't get acrossfade to work properly
Jim Worrall
coniophora at gmail.com
Sat Sep 19 17:05:56 CEST 2015
I am attempting to use ffmpeg to develop a finished video from raw video, with fading audio and video in at the beginning, crossfading them between clips, and fading them out at the end. I have three, 10-second clips for testing (actually came out to 10.04, 10.04, and 10.01). For some earlier clips I got it to work with 2 clips.
Now, with these clips, the video in the first clip freezes when the fading out starts. If I take out the audio filters and output, the video works fine. Three clips doesn't work at all, many buffer queue overflows. But even then, without acrossfade the video works fine. (And I did succeed with 3 clips using a different strategy, concatenating silence to the beginning of 2nd and 3rd clip, then amix, but that is more complex and I’d like to avoid it) But maybe we can deal with that if I can get 2 to work reliably.
The clips are available at:
https://dl.dropboxusercontent.com/u/18324334/t1.mov
https://dl.dropboxusercontent.com/u/18324334/t2.mov
https://dl.dropboxusercontent.com/u/18324334/t3.mov
Here is the command and output for 2 clips:
ffmpeg -i t1.mov -i t2.mov -f lavfi -i color=black -filter_complex \
"[0:v] fade=t=in:d=2, fade=t=out:st=8.04:d=2:alpha=1, setpts=PTS-STARTPTS [v0]; \
[1:v] fade=t=in:d=2:alpha=1, setpts=PTS-STARTPTS+(8/TB), fade=t=out:st=16:d=2 [v1]; \
[2:v] scale=720x480, trim=duration=18.09 [ovr0]; \
[ovr0][v0] overlay [ovr1]; \
[ovr1][v1] overlay [outv]; \
[0:a] afade=t=in:d=2, asetpts=PTS-STARTPTS [a0]; \
[1:a] asetpts=PTS-STARTPTS, afade=t=out:st=8:d=2 [a1]; \
[a0][a1] acrossfade=d=2 [outa]" \
-map [outv] -c:v libx264 -preset ultrafast -map [outa] -c:a libfdk_aac -b:a 256K -y out.mp4
ffmpeg version N-75262-g494b792 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-nonfree --enable-gpl --enable-version3 --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libgsm --enable-libvpx --enable-libfdk-aac --enable-libvorbis --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libfribidi --disable-outdevs --disable-ffserver --disable-network
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 1.100 / 6. 1.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 't1.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.0.100
Duration: 00:00:10.04, start: 0.030333, bitrate: 30310 kb/s
Stream #0:0(eng): Video: dvvideo (dvc / 0x20637664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28771 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)
Metadata:
handler_name : DataHandler
encoder : DV/DVCPRO - NTSC
timecode : 00:04:33;12
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : DataHandler
timecode : 00:04:33;12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 't2.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.0.100
Duration: 00:00:10.04, start: 0.030333, bitrate: 30310 kb/s
Stream #1:0(eng): Video: dvvideo (dvc / 0x20637664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28771 kb/s, SAR 10:11 DAR 15:11, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)
Metadata:
handler_name : DataHandler
encoder : DV/DVCPRO - NTSC
timecode : 00:04:45;12
Stream #1:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #1:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : DataHandler
timecode : 00:04:45;12
Input #2, lavfi, from 'color=black':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #2:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x7fc3cd000c00] using SAR=8/9
[libx264 @ 0x7fc3cd000c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x7fc3cd000c00] profile Constrained Baseline, level 3.0
[libx264 @ 0x7fc3cd000c00] 264 - core 146 r2555 0c21480 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 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=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.0.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.1.100 libx264
Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 256 kb/s (default)
Metadata:
encoder : Lavc57.1.100 libfdk_aac
Stream mapping:
Stream #0:0 (dvvideo) -> fade
Stream #0:1 (pcm_s16le) -> afade
Stream #1:0 (dvvideo) -> fade
Stream #1:1 (pcm_s16le) -> asetpts
Stream #2:0 (rawvideo) -> scale
overlay -> Stream #0:0 (libx264)
acrossfade -> Stream #0:1 (libfdk_aac)
Press [q] to stop, [?] for help
frame= 452 fps= 75 q=-1.0 Lsize= 8113kB time=00:00:18.08 bitrate=3676.1kbits/s
video:7536kB audio:566kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.138662%
[libx264 @ 0x7fc3cd000c00] frame I:2 Avg QP:21.50 size: 29442
[libx264 @ 0x7fc3cd000c00] frame P:450 Avg QP:24.24 size: 17016
[libx264 @ 0x7fc3cd000c00] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x7fc3cd000c00] mb P I16..4: 26.4% 0.0% 0.0% P16..4: 52.0% 0.0% 0.0% 0.0% 0.0% skip:21.6%
[libx264 @ 0x7fc3cd000c00] coded y,uvDC,uvAC intra: 29.5% 24.7% 4.5% inter: 42.7% 30.1% 1.4%
[libx264 @ 0x7fc3cd000c00] i16 v,h,dc,p: 44% 32% 14% 10%
[libx264 @ 0x7fc3cd000c00] i8c dc,h,v,p: 57% 19% 19% 5%
[libx264 @ 0x7fc3cd000c00] kb/s:3414.28
More information about the ffmpeg-user
mailing list