Git Product home page Git Product logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Speaking under correction, but I assume that a typical .avi consists of:

<header><movie>

doing a concatenate should give you
<header><movie><header><movie>

I'm sure there is an ffmpeg way to do it.

Its been a long time, but I know you have to use the /b (binary) flag in dos.
In dos (and I assume windows) copy /b movie1.avi + movie2.avi movie_cat.avi
should do the same thing, but I might be slightly wrong.

Original comment by [email protected] on 9 Jan 2009 at 6:28

from winff.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
From http://howto-pages.org/ffmpeg/

[Quote] You can also use ffmpeg to concatenate multiple videos into one long 
video.
Start by transcoding all the individual videos into MPEG format, all with 
exactly the
same bit rates, codecs, image resolutions, frame rates etc. Mistakes can be 
avoided
by using one of ffmpeg's predefined targets such as ntsc-dvd or pal-dvd. Once 
that's
done, simply string the resulting .mpg files together using "cat" and redirect 
the
output to another .mpg file. Now, the timestamps inside the resulting, big .mpg 
file
are all going to be messed up, so you'll have to process the big .mpg file with
ffmpeg again. This will have the effect of putting the timestamps right. 
[/quote]

Maybe only works for mpeg? But on websites it seems like a general approach.
Apparently ffmpeg is that smart.

Original comment by [email protected] on 9 Jan 2009 at 7:25

from winff.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
the cat'ing only works on mpeg files, but you convert all the files to mpg then 
cat
and then you convert again to the format you like. It's a long involved 
process. It
would be cool though.

(the size of all the videos converted to mpg)x2 + the size of the final encode.

Original comment by [email protected] on 9 Jan 2009 at 9:58

from winff.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Played with this. FFmpeg bitrates, even when specified all the same are not 
converted
to exactly the same every time. It is very inconsistent.  Getting more than 4 
files
would almost guarantee failure. So i am going to wait. 

Original comment by [email protected] on 21 Feb 2009 at 5:01

  • Changed state: Started

from winff.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
From the ffmpeg FAQ:

 3.18 How can I join video files?

A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by
merely concatenating them.

Hence you may concatenate your multimedia files by first transcoding them to 
these
privileged formats, then using the humble cat command (or the equally humble 
copy
under Windows), and finally transcoding back to your format of choice.


ffmpeg -i input1.avi -sameq intermediate1.mpg
ffmpeg -i input2.avi -sameq intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -sameq output.avi

Notice that you should either use -sameq or set a reasonably high bitrate for 
your
intermediate and output files, if you want to preserve video quality.

Also notice that you may avoid the huge intermediate files by taking advantage 
of
named pipes, should your platform support it:


mkfifo intermediate1.mpg
mkfifo intermediate2.mpg
ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null &
ffmpeg -i input2.avi -sameq -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\
ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame output.avi

Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also 
allow
concatenation, and the transcoding step is almost lossless.

For example, let's say we want to join two FLV files into an output.flv file:


mkfifo temp1.a
mkfifo temp1.v
mkfifo temp2.a
mkfifo temp2.v
mkfifo all.a
mkfifo all.v
ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a 
<
/dev/null &
ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a 
<
/dev/null &
ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
ffmpeg -i input2.flv -an -f yuv4mpegpipe - > temp2.v < /dev/null &
cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v &
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
       -f yuv4mpegpipe -i all.v \
       -sameq -y output.flv
rm temp[12].[av] all.[av]

Original comment by [email protected] on 26 Apr 2009 at 9:48

from winff.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
I would like to concatenate to simple H.264 files together (low bit rate and 
baseline
profile) with identical parameters and audio into one H.264 file without trans 
coding
and from the base libs and not from the command line.  I need them staticly 
linked in
my application.  I know that's a lot to ask, but it would be the bomb no my end.

- Sam

Original comment by [email protected] on 8 Dec 2009 at 7:44

from winff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.