Combining files using ffmpeg

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read this

Combining files using ffmpeg

Postby Jimmmac1 on Thu Mar 29, 2012 2:08 pm

Good afternoon.

I have 6 .flv files that I would like to combine into one .flv files. I googled this,

cat file1.flv file2.flv file3.flv file4.flv file5.flv file6.flv | ffmpeg -i - -vcodec copy -acodec copy final.flv

which didn't work. I also get a number of 'Well install this software package and it is easy.' Haven't found that to be so. I would expect there to be a very simple way to combine a number of files into one, but I don't see it, including the ffmpeg faq. Anyone had any luck with getting this done? Thanks.

Jim
Jimmmac1
Level 1
Level 1
 
Posts: 21
Joined: Fri Feb 03, 2012 7:04 pm

Linux Mint is funded by ads and donations.
 

Re: Combining files using ffmpeg

Postby rich2005 on Wed Apr 04, 2012 9:17 am

arrgh why FLV? - never mind that is a rhetorical question.

cat just joins files - any files - does not care about video properties but ffmpeg does. Video has to be same codecs, frame size, frame rate.

use ffprobe filename.flv and at the end of the message you get something like this

Stream #0.0: Video: h264 (Main), yuv420p, 640x480, 333 kb/s, 30 tbr, 1k tbn, 60 tbc
Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 131 kb/s

that tells me that the frame size size is 640x480 and 30 tbr is the frame rate.

I just downloaded 3 of the worst music videos I have ever seen from youtube, where I selected 480 FLV and I get

1.flv 640x480 @ 30 fps
2.flv & 3.flv 854x480 @ 25 fps

So some conversion to do. Normally I use ffmpeg or Avidemux but for once mencoder is best although it has some ridiculous syntax.

1.flv - for this one add pillars to the edges to get 845x480 and change the frame rate to 25 fps to match the other videos. outputs to a 1a.flv

Code: Select all
mencoder 1.flv -oac mp3lame -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf expand=854:480 -ofps 25 -o 1a.flv


some explanation:
why change the audio to mp3? - I could not get aac to work.
why the long vcodec switch? - I have this in my notes as good for flv - you can try a straight vcodec=flv: or a vcodec=flv:vbitrate='some_value_you_choose' and see if the result is acceptable.
Not particularly quick, just be patient.

For 2.flv and 3.flv - very similar just miss off the -vf and -ofps switches since the size and frame rate are the target sizes.

Code: Select all
mencoder 2.flv -oac mp3lame -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -o 2a.flv


finally join them together

Code: Select all
mencoder -forceidx -oac copy -ovc copy -idx -o final.flv 1a.flv 2a.flv 3a.flv


best of luck.
rich2005
Level 3
Level 3
 
Posts: 175
Joined: Sun Nov 07, 2010 5:22 am

Re: Combining files using ffmpeg

Postby Jimmmac1 on Wed Apr 04, 2012 12:17 pm

Hi Oscar

Thanks for your response. I figured a way to do it. Use ffmpeg to change the files to mpg, then use AviDemux. I open the file, let it be indexed, then append the next file. It works very well. The only reason I used .flv files is that I got the documentary files from Youtube, which primarily come as flv files. Thanks again.

Jim
Jimmmac1
Level 1
Level 1
 
Posts: 21
Joined: Fri Feb 03, 2012 7:04 pm

Re: Combining files using ffmpeg

Postby Jimmmac1 on Wed Apr 04, 2012 12:18 pm

Sorry, I mean ric2005. The message I got says it came from oscar. Thanks again.

Jim
Jimmmac1
Level 1
Level 1
 
Posts: 21
Joined: Fri Feb 03, 2012 7:04 pm


Return to Sound, Multimedia, & Codecs

Who is online

Users browsing this forum: No registered users and 2 guests