ffmpeg 同宽度 画中画,FFmpeg的:如何使输出视频具有相同的宽度,高度,和SAR与输入视频...

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?

I think about the 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

but i do not know how to get those values: {width_of_v1}, {height_of_v1}, {sar_of_v1}

解决方案

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

The output of ffprobe can be parsed as JSON or just read to get the width, height, and screen_aspect_ratio of video 1.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值