Re: merge mpg files



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


.



Relevant Pages

  • Re: New Problem with Movies
    ... I can't play video with either totem or mplayer. ... I think the movie is playing, ... Audio stream found, -aid 1 ...
    (Ubuntu)
  • Re: need help watching mpeg movies from archive.org
    ... >The mpeg4, which mplayer identified as a QuickTime movie, played the ... >video aspect of it just fine, but failed to play any sound. ... Opening video decoder: MPEG 1/2 Video decoder libmpeg2-v0.3.1 ... Movie-Aspect is 1.33:1 - prescaling to correct movie aspect. ...
    (freebsd-questions)
  • Re: editing film clips
    ... it to a movie... ... sound in VirtualDub. ... How do I separate the original video file from ... The sound being messed up in the new clip depends on the audio codecs ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: MPlayer vs. Noatun
    ... it lost synchronization between teh sound and video. ... When I play a movie with MPlayer and it stops and I start another movie, ...
    (alt.os.linux.suse)
  • Re: Playing quicktime movies on Firefox
    ... Apologies for jumping in the thread, but when mplayer spews something like ... It seems there is no Xvideo support for your video card available. ... Movie-Aspect is 1.24:1 - prescaling to correct movie aspect. ... what kind of a movie are you trying to play? ...
    (Fedora)