82309

FFMPEG Merge two videos into one with side-by-side same quality output

Question:

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?

Answer1:

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 <a href="https://ffmpeg.org/ffmpeg-filters.html#hstack" rel="nofollow">hstack</a> 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:

<ul><li>lossless H.264: -c:v libx264 -crf 0</li> <li>huffyuv: -c:v huffyuv</li> <li>ffvhuff: -c:v huffyuv</li> <li>UT Video: -c:v utvideo</li> <li>And of course lossless uncompressed formats including rawvideo.</li> </ul>

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 <a href="https://ffmpeg.org/ffmpeg-filters.html#amerge" rel="nofollow">amerge</a> 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 <a href="https://trac.ffmpeg.org/wiki/Encode/H.264" rel="nofollow">FFmpeg Wiki: H.264 Video Encoding</a>.

Recommend

  • How to select sequential duplicates in SQL Server
  • how to insert a new column in a dataset with values if it satisfies a statement
  • How can i decode an mp3 and encode it as aac with ezstream
  • Fail SonarQube quality gate when coverage decreases
  • Pass pointer array to function
  • Line with fill and stroke
  • Youtube Video Player Fullscreen click event
  • Change the width of the JQM panels
  • SIP Makefile fail (gnuwin and mingw)
  • How do I create an image and save it for later to draw as texture in XNA?
  • Plotting Route with Multiple Points in iOS
  • How to add learning rate to summaries?
  • Parenthesis() and SQL Query Performance
  • Save image as is in photo album using swift
  • Login not working in Firefox in Meteor
  • Differences in dis-assembled C code of GCC and Borland?
  • Button click event not firing in jQuery
  • Unable to decode certificate at client new X509Certificate2()
  • Excel's Macro-Recorder usage
  • How to handle images sent by a mobile device?
  • java inputstream
  • chrome.tabs.executeScript only fires when the Developer Console is open
  • How to render a blob on a canvas element?
  • Custom Tabgroup Appcelerator
  • How to use an array of arrays with array_map(…) in PHP?
  • FFmpeg Conversion Error
  • Initializer list vs. initialization method
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • Deserializing XML into class C#
  • what is the difference between the asp.net mvc application and asp.net web application
  • Large data - storage and query
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • WOWZA + RTMP + HTML5 Playback?
  • Matrix multiplication with MKL
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • python draw pie shapes with colour filled
  • Binding checkboxes to object values in AngularJs
  • How to Embed XSL into XML