[FFmpeg-user] Drawtext and crossfade effect

local host local.host.portable at gmail.com
Sat Jul 28 17:04:25 EEST 2018


It's works !! Thanks for your help !

Le sam. 28 juil. 2018 à 12:53, DopeLabs <dopelabs at dubstep.fm> a écrit :

> i copied a short video and inverted the color in second.mp4 by using the
> negate filter so the cross fade is from regular color to inverted color...
> then i just added the drawtext as the next item in the filter_complex
>
>
> you can see the output here: http://www.dopelabs.com/video/crosstext.mp4
>
>
> $ ffmpeg -i first.mp4 -i second.mp4 -filter_complex
> '[0:v]trim=start=0:end=2,setpts=PTS-STARTPTS[0_clip_1];[0:v]trim=start=2:end=3,setpts=PTS-STARTPTS[fadeoutsrc_0];[fadeoutsrc_0]format=pix_fmts=yuva420p,fade=t=out:st=0:d=1:alpha=1[fadeout_0];[fadeout_0]fifo[fadeoutfifo_0];[1:v]trim=start=1,setpts=PTS-STARTPTS[1_clip_2];[1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc_1];[fadeinsrc_1]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1[fadein_1];[fadein_1]fifo[fadeinfifo_1];[fadeoutfifo_0][fadeinfifo_1]overlay[crossfade_1];[0_clip_1][crossfade_1][1_clip_2]concat=n=3[output];[output]drawtext=text="lets
> be friends":fontcolor=white:fontsize=40:box=1:boxcolor=red at 0.5:boxborderw=10:x=5:y=5[out]'
> -map "[out]" crosstext.mp4
> ffmpeg version N-91398-gd08d4a8c73 Copyright (c) 2000-2018 the FFmpeg
> developers
>   built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
>   configuration: --enable-libmp3lame --enable-opencl --enable-audiotoolbox
> --enable-videotoolbox --enable-libx265 --enable-libx264 --enable-libxvid
> --enable-libfdk-aac --enable-lzma --enable-gnutls --enable-fontconfig
> --enable-libfreetype --enable-libfribidi --enable-nonfree --enable-gpl
> --enable-libass --enable-swscale --enable-avfilter --enable-libvorbis
> --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg
> --enable-libmodplug --enable-libvpx --enable-avresample --enable-libsoxr
> --enable-libspeex --enable-libcaca --enable-opengl --enable-libtesseract
>   libavutil      56. 18.102 / 56. 18.102
>   libavcodec     58. 20.104 / 58. 20.104
>   libavformat    58. 17.101 / 58. 17.101
>   libavdevice    58.  4.101 / 58.  4.101
>   libavfilter     7. 25.100 /  7. 25.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  2.100 /  5.  2.100
>   libswresample   3.  2.100 /  3.  2.100
>   libpostproc    55.  2.100 / 55.  2.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'first.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42mp41isom
>     creation_time   : 2017-07-30T18:31:27.000000Z
>   Duration: 00:00:29.50, start: 0.000000, bitrate: 233 kb/s
>     Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
> 0x31637661), yuv420p, 400x392, 233 kb/s, 10.03 fps, 10 tbr, 1k tbn, 2k tbc
> (default)
>     Metadata:
>       creation_time   : 2017-07-30T18:31:27.000000Z
>       handler_name    : Twitter
> v1.0-757770b7c8e9d79a526cdff77e74666386274fdf
>       encoder         : AVC Coding
> Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'second.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf58.17.101
>   Duration: 00:00:29.60, start: 0.000000, bitrate: 335 kb/s
>     Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 400x392, 334 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default)
>     Metadata:
>       handler_name    : Twitter
> v1.0-757770b7c8e9d79a526cdff77e74666386274fdf
> [Parsed_drawtext_16 @ 0x7fc17b50e240] Using "/Library/Fonts/Verdana.ttf"
> Stream mapping:
>   Stream #0:0 (h264) -> trim
>   Stream #0:0 (h264) -> trim
>   Stream #1:0 (h264) -> trim
>   Stream #1:0 (h264) -> trim
>   drawtext -> Stream #0:0 (libx264)
> Press [q] to stop, [?] for help
> [Parsed_drawtext_16 @ 0x7fc17db00a80] Using "/Library/Fonts/Verdana.ttf"
> [libx264 @ 0x7fc17d002200] using cpu capabilities: MMX2 SSE2Fast SSSE3
> SSE4.2 AVX FMA3 BMI2 AVX2
> [libx264 @ 0x7fc17d002200] profile High, level 2.1
> [libx264 @ 0x7fc17d002200] 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=10
> scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
> qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, mp4, to 'crosstext.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42mp41isom
>     encoder         : Lavf58.17.101
>     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
> 400x392, q=-1--1, 10 fps, 10240 tbn, 10 tbc (default)
>     Metadata:
>       encoder         : Lavc58.20.104 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
> frame=  316 fps=286 q=-1.0 Lsize=    1257kB time=00:00:31.30 bitrate=
> 328.9kbits/s speed=28.3x
> video:1252kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.351230%
> [libx264 @ 0x7fc17d002200] frame I:2     Avg QP:19.73  size: 25817
> [libx264 @ 0x7fc17d002200] frame P:101   Avg QP:21.65  size:  8335
> [libx264 @ 0x7fc17d002200] frame B:213   Avg QP:25.58  size:  1822
> [libx264 @ 0x7fc17d002200] consecutive B-frames:  6.0%  9.5%  8.5% 75.9%
> [libx264 @ 0x7fc17d002200] mb I  I16..4:  4.2% 58.5% 37.4%
> [libx264 @ 0x7fc17d002200] mb P  I16..4:  1.2%  7.6%  4.5%  P16..4: 33.6%
> 28.4% 16.4%  0.0%  0.0%    skip: 8.3%
> [libx264 @ 0x7fc17d002200] mb B  I16..4:  0.3%  1.0%  0.6%  B16..8: 52.2%
> 12.4%  3.1%  direct: 3.0%  skip:27.5%  L0:49.6% L1:39.7% BI:10.7%
> [libx264 @ 0x7fc17d002200] 8x8 transform intra:56.7% inter:57.5%
> [libx264 @ 0x7fc17d002200] coded y,uvDC,uvAC intra: 77.2% 71.3% 23.6%
> inter: 29.0% 19.9% 0.5%
> [libx264 @ 0x7fc17d002200] i16 v,h,dc,p: 63% 13% 10% 14%
> [libx264 @ 0x7fc17d002200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 17% 14%  5%
> 8%  7%  9%  6%  8%
> [libx264 @ 0x7fc17d002200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 16% 12%  5%
> 7%  6%  7%  6%  6%
> [libx264 @ 0x7fc17d002200] i8c dc,h,v,p: 48% 21% 24%  8%
> [libx264 @ 0x7fc17d002200] Weighted P-Frames: Y:5.0% UV:2.0%
> [libx264 @ 0x7fc17d002200] ref P L0: 57.7% 30.6%  9.1%  2.5%  0.1%
> [libx264 @ 0x7fc17d002200] ref B L0: 96.9%  2.6%  0.5%
> [libx264 @ 0x7fc17d002200] ref B L1: 99.5%  0.5%
> [libx264 @ 0x7fc17d002200] kb/s:324.47
>
>
>
>
> > On Jul 27, 2018, at 4:34 41PM, local host <local.host.portable at gmail.com>
> wrote:
> >
> > Hello,
> >
> > I have one video with crossfade effect and i want add text on this video
> > (drawtext).
> > However when i add a filter text, he remove a crossfade effect in the
> final
> > video.
> >
> > Command to create video with crossfade effect:
> > ffmpeg -i first.mp4 -i second.mp4 -filter_complex
> > "[0:v]trim=start=0:end=2,setpts=PTS-STARTPTS[0_clip_1];
> > [0:v]trim=start=2:end=3,setpts=PTS-STARTPTS[fadeoutsrc_0];
> >
> [fadeoutsrc_0]format=pix_fmts=yuva420p,fade=t=out:st=0:d=1:alpha=1[fadeout_0];
> >
> [fadeout_0]fifo[fadeoutfifo_0];[1:v]trim=start=1,setpts=PTS-STARTPTS[1_clip_2];
> > [1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc_1];
> >
> [fadeinsrc_1]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1[fadein_1];
> > [fadein_1]fifo[fadeinfifo_1];
> > [fadeoutfifo_0][fadeinfifo_1]overlay[crossfade_1];
> > [0_clip_1][crossfade_1][1_clip_2]concat=n=3[output];[0:a][1:a]
> > acrossfade=d=1 [audio]"
> > -map "[output]" -map "[audio]" videoWithCrossfade.mp4
> >
> > Command to add filter text:
> > ffmpeg -i videoWithCrossfade.mp4 -filter_complex
> > "/Windows/fonts/arial.ttf':text='hello
> > world!':fontcolor=white:fontsize=40:box=1:boxcolor=red
> > @0.5:boxborderw=10:x=500:y=500"
> > output.mp4
> >
> > this is the link of video:
> >
> http://www.mediafire.com/file/kw3lvdb2rp1bs6u/videoWithCrossfade.mp4/file
> >
> > http://www.mediafire.com/file/iycdzozsqzosq87/output.mp4/file
> >
> > Thanks for your help !
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list