Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a handful of FLV files that are in fact a single sequence. I'd like to combine them into a single file, e.g. part1.flv, part2.flv, part3.flv become final.flv.

What is the easiest way that I can do this without losing video quality?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

I'd suggest mencoder. This is a part of mplyaer and can be used at command line:

mencoder -oac copy -ovc copy -o final.avi part1.flv part2.flv part3.flv

Normally -oac and -ovc are for special audio and video codecs. In this case the commands says it just should (stream)copy them. The option -o gives the name of the output file.

The output could be forced to FLV, but this is currently buggy, and you will get the following message if you try adding -of lavf:

REMEMBER: MEncoder's libavformat muxing is presently broken and can generate INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer will play these INCORRECT files as if nothing were wrong!

According to your comment you got the error:

Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.

According to a blog entry this is caused by attempting to convert AAC audio. In this case you can try -oac mp3lame instead.

Otherwise, add the option -fafmttag plus a code for your audio codec. Usually mplayer has a file etc/codecs.conf. There you'll find which code maps to which codec. This file does not always exist.

If this doesn't work for you, you can also recode the audio. However this is too complex to describe in this answer. You'll need to look at the manpage or ask another question here.

share|improve this answer
    
thanks! I get Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it. which option should I use? –  d3vid Jan 18 '13 at 13:36
2  
I used -oac pcm and it worked. This forced the output to be an AVI instead of FLV, which doesn't bother me, but the combined file is 3 times the size of the originals. Any suggestions? –  d3vid Jan 18 '13 at 14:13
    
You might recode the audio part as I describe in an update to my answer. –  qbi Jan 18 '13 at 14:23
1  
avi is preferred because the flv encoder is buggy; I used -oac mp3lame based on betterlogic.com/roger/2011/05/… and it worked, I now have an AVI only slightly larger than the originals –  d3vid Jan 21 '13 at 8:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.