FFmpeg的:如何使输出视频具有相同的宽度,高度,和SAR与输入视频 [英] FFmpeg: how to make output video has the same width, height, and SAR with input video
问题描述
我有2个视频:v1.mp4和v2.mp4。我想打一个输出视频这是一个复制的,v2.mp4视频,但有相同的宽度,高度,特区与v1.mp4。
我怎么能做到这一点的ffmpeg的命令?
I have 2 videos: v1.mp4 and v2.mp4. I want to make a output video that is a copied-v2.mp4 video but has the same width, height, SAR with v1.mp4. How could i do that by ffmpeg command?
我想下面的命令:
ffmpeg -i v1.mp4 -i v2.mp4 -filter_complex [1:v]scale={width_of_v1}:{height_of_v1},setsar={sar_of_v1}[out] out.mp4
但我不知道如何获取这些值: {width_of_v1},{height_of_v1},{} sar_of_v1
推荐答案
有可能是一种方式来获得在一行中的值,但我只想首先从视频1得到的值,然后插在数字/字符串成视频2.这可以编程与ffprobe来完成,例如,通过该命令:
There is probably a way to get the values in one line, but I would just first get the values from video 1, and then plug in the numbers / strings into video 2. This can be done programatically with ffprobe, for example, by this command:
ffprobe -print_format json -show_format -show_streams v1.mp4
ffprobe的输出可以解析为JSON或只是读来获取宽度,高度和视频1 screen_aspect_ratio。
The output of ffprobe can be parsed as JSON or just read to get the width, height, and screen_aspect_ratio of video 1.
这篇关于FFmpeg的:如何使输出视频具有相同的宽度,高度,和SAR与输入视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!