【问题标题】:Merging\Joining three FFMPEG Commands (Drawtext / -filter_complex overlay / anullsrc=channel_layout)合并\加入三个 FFMPEG 命令(Drawtext / -filter_complex overlay / anullsrc=channel_layout)
【发布时间】:2020-12-18 11:27:10
【问题描述】:

目前我正在使用三个不同的命令来创建三个 mp4,只是为了使用此代码删除两个“临时”视频。

@ECHO OFF
ffmpeg -f lavfi -i color=size=1280x720:duration=5:rate=25:color=Black -vf "drawtext=fontfile='GothamRnd-Book.otf':line_spacing=15:fontsize=15:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text=Stack Exchange" "out1.mp4"
ffmpeg -i "out1.mp4" -i logo.png -filter_complex "overlay=x=10:y=10" "out2.mp4"
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -i "out2.mp4" -c:v copy -c:a aac -shortest "out3.mp4"
del "out1.mp4"
del "out2.mp4"
pause

我最近的方法是将anullsrc=channel_layout 移动到-filter_complex 中,但这会导致编码很长,我真的不明白这是怎么回事,因为如果我ctrl-c 取消批处理仍然会创建out3.mp4正确。

ffmpeg -f lavfi -i color=size=1280x720:duration=5:rate=25:color=Black -vf "drawtext=fontfile='GothamRnd-Book.otf':line_spacing=15:fontsize=15:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text=Stack Exchange" "out1.mp4"
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000  -i "out1.mp4" -i logo.png -filter_complex "overlay=x=10:y=10" "out3.mp4"

这似乎可以简化为不创建临时文件。 但也许这是唯一的方法。感谢您的帮助,如果答案很明显,我们深表歉意。

罗里

【问题讨论】:

    标签: windows batch-file ffmpeg drawtext


    【解决方案1】:

    使用

    ffmpeg -f lavfi -i color=s=1280x720:d=5:r=25:color=black -i logo.png -f lavfi -i anullsrc=cl=stereo:d=5:r=48000 -filter_complex "[0]drawtext=fontfile='GothamRnd-Book.otf':line_spacing=15:fontsize=15:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text=Stack Exchange[vid];[vid][1]overlay=x=10:y=10" -c:v libx264 -c:a aac "out3.mp4"

    【讨论】:

    • 这对你有用吗?我错误:[Parsed_anullsrc_0 @ 000002316c8a0b80] Option 'd' not found [lavfi @ 000002316c89aa80] Error initializing filter 'anullsrc' with args 'cl=stereo:r=48000:d=5' anullsrc=cl=stereo:r=48000:d=5: Option not found ,当我删除持续时间选项时,它变成:[AVFilterGraph @ 000001c361d76f40] Unable to parse graph description substring: "]vid];[vid][1]overlay=x=10:y=10" Error initializing complex filters. Invalid argument
    • ]vid] 是一个错字。已更正。 d in anullsrc 是一个新选项。你需要一个最近的 git build。对于旧版本,您可以在-i anullsrc 之前添加-t 5
    • 现在可以使用 -t 5 选项。 -i 输入是否都必须先定义?我已经阅读了有关 -map 0:v:0 的信息流,但没有阅读 [vid]。这必须是-filter_complex 映射。再次感谢。
    • 回复:-i,严格来说不可以,但建议在命令中清晰明了。 [vid] 里面 filtergraphs 是一个过滤垫,见ffmpeg.org/ffmpeg-filters.html#Filtergraph-description
    • 太棒了。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2016-10-07
    • 1970-01-01
    • 1970-01-01
    • 2014-10-18
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多