FFMPEG将两个视频合并成一个具有并排相同质量输出的视频 [英] FFMPEG Merge two videos into one with side-by-side same quality output
问题描述
ffmpeg -i avatar35l.avi -vfmovie = avatar35r.avi [in1]; [in] pad = 1920 * 2 :1080 [in0]; [in0] [in1] overlay = 1920:0 [out]avatar35sbs.avi
它的作品,但我有重大的质量损失,我需要质量输出视频相同的输入视频,30fps,1080p,相同的长度,我是一个新的ffmpeg,我需要一个具体的例子这个
有人能帮我吗?
无损
你必须使用真正的无损如果您需要输出视频的质量与输入视频相同,则格式化。使用 hstack 过滤器而不是电影+ pad + overlay的ffv1示例:
ffmpeg -i left.avi -i right.avi -filter_complex hstack -c:v ffv1 output.avi
FFmpeg支持几种额外的无损压缩格式,例如:
- 无损H.264:
-c:v libx264 -crf 0
- huffyuv:
c:v huffyuv
- ffvhuff:
-c:v huffyuv
- UT视频:
-c:v utvideo
- 当然还有无损的未压缩格式,包括rawvideo。
由于它是无损的,输出文件将是巨大的,你的播放器或设备可能不会喜欢它。
视觉无损
当然,您可能想要的是有损,但视觉无损,但不是一个巨大的巨大文件,如真正的无损提供 。在这种情况下,使用:
ffmpeg -i left.avi -i right.avi -filter_complexhstack,format = yuv420p c:v libx264 -crf 18 output.mp4
你没有提到音频。如果要合并每个输入的音频,还可以使用 amerge 过滤器:
ffmpeg -i left.avi -i right.avi -filter_complex[0:v] [1:v] hstack,format = yuv420p [v]; [0:a] [1:a] amerge [a]-map[v]-map[a]-c:v libx264 -crf 18 -ac 2 output.mp4
I´m already working on project with 3d video an i have problem,i got left and right channel of video a a ineed to merge it into side by side.I already read some blogs about this problem and i got this code:
ffmpeg -i avatar35l.avi -vf "movie=avatar35r.avi [in1]; [in]pad=1920*2:1080[in0]; [in0][in1] overlay=1920:0 [out]" avatar35sbs.avi
it works,but i got significant quality loss and i need a quality of output video same as input video,30fps,1080p,same lenght,i´m a new one to ffmpeg and i need a concrete example of that
Can anybody help me?
Lossless
You'll have to use a truly lossless format if you require "a quality of output video same as input video". Example for ffv1 using the hstack filter instead of movie+pad+overlay:
ffmpeg -i left.avi -i right.avi -filter_complex hstack -c:v ffv1 output.avi
FFmpeg supports several additional lossless compressed formats such as:
- lossless H.264:
-c:v libx264 -crf 0
- huffyuv:
-c:v huffyuv
- ffvhuff:
-c:v huffyuv
- UT Video:
-c:v utvideo
- And of course lossless uncompressed formats including rawvideo.
Since it is lossless the output file will be huge, and your player or device will probably not like it.
Visually lossless
Of course what you may actually want is "lossy, yet 'visually lossless', but not a gigantic, huge file like true lossless provides". In that case use:
ffmpeg -i left.avi -i right.avi -filter_complex "hstack,format=yuv420p" -c:v libx264 -crf 18 output.mp4
You didn't mention audio. If you want to merge the audio from each input as well use the amerge filter:
ffmpeg -i left.avi -i right.avi -filter_complex "[0:v][1:v]hstack,format=yuv420p[v];[0:a][1:a]amerge[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 18 -ac 2 output.mp4
See FFmpeg Wiki: H.264 Video Encoding.
这篇关于FFMPEG将两个视频合并成一个具有并排相同质量输出的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!