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

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

问题描述

我正在研究一种可能性,可以存储来自已经用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和/或crop过滤器.使用裁剪滤镜从高处删除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文档

See the mpv documentation and FFmpeg Filters for more info.

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

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