English 中文(简体)
stitching videos together using ffmpeg on the command line
原标题:

Does anybody know how to stitch two (or more) videos together using ffmpeg (or another cli)? This is assuming that all the videos are in the same format and the video format being used allows for lossless stitching (no transcode, just end-to-end stitching).

最佳回答

Using ffmpeg I think the command you want is

-newvideo

the help describes this as "add a new video stream to the current output stream"

although I personally have not tried it.

问题回答

You can stitch two or more videos with ffmpeg that are in a format that can be concatenated by doing this:

$ cat file1.avi file2.avi > cat_output.avi
$ ffmpeg -i cat_output.avi -r 25 -sameq stitched.avi 

The second step it necessary where ffmpeg merges the joined files into a proper readable video file.

There is no such thing as -newvideo in ffmpeg to my knowledge.

for newer ffmpeg s there is a "concat" input option too: http://ffmpeg.org/faq.html#How-can-I-join-video-files_003f

See also Concatenate two mp4 files using ffmpeg

You can concatenate and encode multiple .avis using mencoder like so:

$ cat part1.avi part2.avi > tmp.avi && mencoder -forceidx -oac copy -ovc copy tmp.avi -o final.avi && rm -f tmp.avi

If you re using OS X, mencoder is part of the mplayer Homebrew package. You can install it easily enough with:

$ brew install mplayer

We added support for stitching videos with ffmpeg (static build required) in Java to ffmpeg-cli-wrapper. For stitching videos, check out this example. Library also supports fade in, fade out, text overlays etc.





相关问题
Non-linear video editing tool/API?

Can anyone recommend a good library that would enable me to write an application that can blend multiple input videos into one output video (for example into a split screen). I don t care about the ...

WPF playing a video, shopping up, can I preload?

Im showing a video int my application, but its being chopped up, its locally on disc so I dont understand why this is so... any way i can start to preload it before playing it - so the content would ...

FLVs on timeline are glitching out

I have a Movieclip with about five FLV movies embedded on its timeline, one after another. I am loading multiple instances (about 5-10) of this movieclip onto the stage. Once added to the stage, they ...

Get the dimensions of a H.264 MP4

Does anybody know a ready-made, reliable way to tell the dimensions (width x height) of a MP4 encoded using the H.264 codec without ffmpeg or similar extensions, in pure PHP? Thanks for all the ...

热门标签