Re: merge mpg files
- From: tarper@xxxxxxxxxxx
- Date: Tue, 08 Aug 2006 14:02:26 +0200
Hello Houghi,
houghi wrote:
Now for some reason you would like to add these two together, yet they
are different in width and height. Would that work?
IMHO not, because dimensions and framerates get configured once at startup.
<offroad-computing>
With "mplayer", record the sound to a WAV track and the video source to PNG
files. Each frame one picture, 25 to 30 per second of video.
I haven't done yet, but I'm sure it is possible to resize these pictures
with some magic line in a script, (e.g. via Gimp).
25fps->30fps is copying every fifth frame, 30fps->25fps is deleting every
fifth frame.
After that, replay your new stack of frames with "mplayer" and record it as
YUV file.
Re-conversion to MPG with sound, see below.
</offroad-computing>
I usually record movies from /dev/video0 with the command "streamer" (from
v4l-tools). The result of this is a YUV file containing the video data and
a WAV file containing stereo sound.
These uncompressed data get prepared seperately with
"mp2enc" for WAV->MP2 (MPEG sound)
and
"mpeg2enc" for YUV->M1V (MPEG video)
with the command "mplex", these separate tracks (audio and video) get
multiplexed to one MPG video with sound. In MPEG2 format.
<streamer --help>
build mpeg movies using mjpegtools + raw, uncompressed video:
streamer -t 0:30 -s 352x240 -r 24 -o video.yuv -O audio.wav -F stereo
mp2enc -o audio.mp2 < audio.wav
mpeg2enc -o video.m1v < video.yuv
mplex audio.mp2 video.m1v -o movie.mpg
</streamer --help>
So far so good. But this huge file of up to three hours usually contains
lots of commercials I don't want to see every time I watch the movie.
"mpgtx" is a GOP editor for MPEG files with a resolution of about half a
second. Using mplayer's console output for navigation, I determine the
range of seconds I want to cut out of the movie and store these snippets to
numbered target files.
When I then try to re-catenate these snippets to a cleaned movie, mpgtx
usually refuses to do so.
Catenating them quick and dirty via "cat snippet-*.mpg > movie.mpg" may work
sometimes, but usually the movie crashes where I took out the first
commercials. It's out of the same source! Same picture size, same fps-rate.
But since the source was MPEG2 (dynamic buffering/data rate), the edges of
my movie snippets don't fit together.
To ensure that all snippets I want to catenate will finally add up to a
working movie, I have to convert these snippets (or the source) explicitely
to MPEG1. Either directly via "mencoder" (part of mplayer) or with
"tabencode". The latter is a GUI for mencoder. This implements static data
rate and disables dynamic buffering.
These MPEG1 snippets then get catenated via "cat snippet-*.mpg > movie.mpg",
or better mpgtx, to the clean movie. The result is a stable monolithic
MPEG1 movie, which can be re-converted to MPEG2 via tabencode if needed.
Greetings
Tarper
Origin of mentioned tools:
SuSE 9.3: v4l-tools/streamer, mjpegtools
Web: mplayer/mencoder, mpgtx, tabencode
.
- Follow-Ups:
- Re: merge mpg files
- From: houghi
- Re: merge mpg files
- References:
- Re: merge mpg files
- From: houghi
- Re: merge mpg files
- From: Rikishi 42
- Re: merge mpg files
- From: houghi
- Re: merge mpg files
- Prev by Date: Re: Suse 10.1 Network problems
- Next by Date: Re: Suse 10.1 Network problems
- Previous by thread: Re: merge mpg files
- Next by thread: Re: merge mpg files
- Index(es):
Relevant Pages
|