[MPlayer-users] Cut out a piece of real media file

The Wanderer inverseparadox at comcast.net
Fri Aug 18 00:47:45 CEST 2006


(I've probably stated something which isn't correct... I really
shouldn't post when tired, but this is a simple question, I'm fairly
sure about most of the answer.)

Maciej Bliziński wrote:

> Hello MPlayer users,
> 
> Is it possible to cut out a piece of a real-media file? The file
> plays fine. I'd like to cut out, say from 5:00 to 10:00 and save it
> as a separate file, without recoding.

Unfortunately, unless the segment you're wanting to pull out happens to
begin exactly on a keyframe, this is impossible even in theory. In
practice, even if you *do* happen to begin on a keyframe, I don't
believe that this is possible with MPlayer/MEncoder. ('mencoder -ovc
copy -oac copy' might be able to do it, but ISTR that that doesn't work
well - or necessarily at all - with -ss. I may be remembering
incorrectly, however.)

In order to copy out that segment without producing garbage, you will
have to transcode the data.

> I can ask MPlayer to play from the
> place I want:
> 
> mplayer -ss 5:00 myfile.rm
> 
> But when I try to "save" it:
> 
> mplayer -dumpstream -ss 5:00 myfile.rm
> 
> It dumps the whole stream, from the very beginning.

That's what '-dumpstream' does. It is intended to produce a full,
byte-for-byte copy of the input stream; any modification whatsoever,
including omitting any parts, means that you're no longer doing
streamcopy and so is not part of what '-dumpstream' is for.

Even if MPlayer did not ignore your seek request, the resulting file
would be garbage, because it would not have the correct headers which
appear at the beginning of the file. (Leaving the headers in, while
probably not utterly impossible, would tend to mean that they would
contain inaccurate information - at least if the headers include an
index, which some formats do.) It would almost certainly not be playable
by anything, at least not without major repair work.

> Is there a way to cut out the given piece of a real media file?

Not without transcoding it, no, unless the part you want happens to
begin on a keyframe.

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.



More information about the MPlayer-users mailing list