我正在尝试添加水印,然后修剪特定部分,最后通过以下命令将它们连接起来:
ffmpeg -y -i test_video.mp4 -filter_complex \
"[0:v]drawtext=fontfile=Lato-light.ttf:text='test':fontcolor=white:fontsize=20:x=0:y=h-th[outv]; \
[outv]trim=2:5[v1];[outv]trim=7:9[v2];[v1][v2]concat=n=2:v=1:a=0[out]" \
-map '[out]' test_video_text.mp4
但没有成功并出现以下错误:
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-vda
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_video.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2015-09-24 18:32:33
Duration: 00:00:09.87, start: 0.068254, bitrate: 235 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x320, 183 kb/s, 29.67 fps, 29.67 tbr, 29673 tbn, 59.35 tbc (default)
Metadata:
creation_time : 2015-09-24 18:32:33
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 48 kb/s (default)
Metadata:
creation_time : 2015-09-24 18:32:33
handler_name : Core Media Audio
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fff43000000] Invalid stream specifier: outv.
Last message repeated 1 times
Stream specifier 'outv' in filtergraph description [0:v]drawtext=fontfile=Lato-Light.ttf:text='test':fontcolor=white:fontsize=20:x=0:y=h-th[outv]; [outv]trim=2:4[v1];[outv]trim=6:8[v2];[v1][v2]concat=n=2:v=1:a=0[out] matches no streams.
请有人指导我我做错了什么?
答案1
outv
已经布线一次,至第一个修剪。使用拆分:
ffmpeg -y -i test_video.mp4 -filter_complex \
"[0:v]drawtext=fontfile=Lato-light.ttf:text='test':fontcolor=white:fontsize=20:x=0:y=h-th[outv]; \
[outv]split[o1][o2]; \
[o1]trim=2:5,setpts=PTS-STARTPTS[v1]; \
[o2]trim=7:9,setpts=PTS-STARTPTS[v2]; \
[v1][v2]concat=n=2:v=1:a=0[out]" \
-map '[out]' test_video_text.mp4