一个文件中的多个左右视频流,无需转码 [英] Multiple side-to-side video streams in one file without transcoding

查看:35
本文介绍了一个文件中的多个左右视频流,无需转码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一种可能性,可以存储来自少数已经以 h264 编码的源的视频流,而无需进行视频转码,因为我想用于该项目的设备将无法即时转码组合视频.

I am investigating a possibility to store video streams which are coming from few sources already coded in h264 without video transcoding as the device I would like to use for this project won't be capable of transcoding combined video on the fly.

我要找的是两张或更多张并排的图片(不是视频连接)打包成 mp4/avi/mkv.

What I am looking for is two or more pictures side to side (not video concatenation) packed into mp4/avi/mkv.

我相信 mkv 容器支持这种包装,但我一直无法为 ffmpeg 或其他工具找到合适的选项来以这种方式存储它.它所做的是将非常慢的视频转码成一个大的 h264 流.

I believe mkv container supports such kind of packaging but I've not been able to find appropriate options for ffmpeg or other tool to store it this way. What it does is very slow video transcoding into one big h264 stream.

推荐答案

如果您的播放器可以处理它,只需让它执行并排视图.无需编码或混合.

If your player can handle it just make it perform the side-by-side view. No encoding or muxing required.

使用 mpv 的示例:

mpv --lavfi-complex="[vid1][vid2]hstack[vo];[aid1][aid2]amix[ao]" input1.mp4 --external-file=input2.mp4

上面的例子假设每个输入都具有相同的高度.否则,您将不得不添加 scale、scale2ref、pad 和/或裁剪过滤器.使用裁剪过滤器从高度移除 20 个像素的简单示例:

The above example assumes each input has the same height. Otherwise you will have to add the scale, scale2ref, pad, and/or crop filters. Simple example using the crop filter to remove 20 pixels from the height:

mpv --lavfi-complex="[vid1]crop=iw:ih-20[c];[c][vid2]hstack[vo];[aid1][aid2]amix[ao]" input1.mp4 --external-file=input2.mp4

请参阅 mpv 文档FFmpeg 过滤器了解更多信息.

See the mpv documentation and FFmpeg Filters for more info.

这篇关于一个文件中的多个左右视频流,无需转码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆