[MPlayer-dev-eng] [PATCH] Multiple files for MEncoder

Oded Shimon ods15 at ods15.dyndns.org
Mon Feb 14 18:17:01 CET 2005


On Tuesday 08 February 2005 11:27, Oded Shimon wrote:
> As most of you probably know, I've been working on multiple file support
> for MEncoder. this patch is a "first draft". Things which could be
> improved:
> 1. Somehow remove redundancy by not having most of the same video 
> init code twice. The init for each next file is a little different from the
> first file, so I couldn't just 'goto' to before the init, but repetitive
> code is always bad...
Fixed.

> 2. Better support for audio - as is, if the user specifies '-af' it only
> affect the first file. Also no checks are made against merging 2 files
> which have different audio
Fixed. still no checks though.

> 3. Fixing most of the MEncoder options to be properly global. As is, '-ovc'
> and '-oac' for ex. are "per file" options, not the most desireable
> situation...
Fixed.
I'm not 100% sure I got all of them right, as some of these options I have 
never used and do not know their significance... please look over the patch 
and tell me if it's OK.

> 4. Perhaps improving dealing with bad merging of files?  As is, if the user
> asks to merge 2 files which are of different resolution, MEncoder exits
> with error when reaching the second file - a possibly depressing result if
> the user waited a long time for the encode of the first file. The user can
> still do this however, and it will work perfectly:
> mencoder 1.avi 2.avi -vf scale=whatever
> And only the 2nd file will be scaled, as necessary.
Hasn't changed.

> 5. Patching the man page as necessary of course...
Uhhh, haven't done that yet :)

> Whats in this patch:
> 1. A goto label before begginning to read the first file, and an entire
> re-initing of the demuxer for each file.
Obviously different now, there's a jump to before all video initing, and msot 
output initing is wrapped around an 'if'.

> 2. Audio cutting according to -endpos or -frames, so transition between
> files is smooth. -frames was done with a slight hack - multiplying the rest
> of the frames with the fps of the output file. Should work in any situation
> I can think of, unless frames were skipped/duplicated, but the code will
> "fix itself" in this situation, the only defect would be not a perfect
> audio-preload.
> 3. After the first frame of every movie, Resolution is checked against the
> previous movie, unless direct stream copy or frameno was chosen.
> 4. Some error messages in cases of video files mismatch in help_mp-en.h .
5. A modification to '-endpos' to make it "saveable"
As it was before, if the user did:
mencoder a.avi -endpos 5 b.avi
The first 'endpos' would affect 'b.avi' too. endpos.patch fixes this.
6. A helper function to calculate how much time is left before the transition 
to the next movie. Will be helpful for EDL for MEncoder in the future too.
7. All the changes mentioned above...

> All tests I made were successful, including direct stream copy of audio
> and/or video, frameno, merging bad files, etc. etc.
> I don't understand and have never used this 3-pass "audio-only" think, so
> there might be issues with it. No reason why there should be, but it was
> never tested...
One small "bug" - in every transition between files, a keyframe will be 
entered, as the vf is completely un-inited and re-inited. Not much can be 
done against this...
Probably worth mentioning, MEncoder segfaulted for me when trying to merge 300 
files. when trying a slightly different 300 files set (even removing a single 
file from the list or adding one), it didn't segfault. also due to changes in 
cfg-mencoder.h, for some reason, it stopped segfaulting... backtrace shows 
segfault was in libc's calloc(). I honestly don't know how to begin to debug 
that, so I'm marking it off as a fluke.

Other than that, patch seems flawless to me...

- ods15 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfg-mencoder.patch
Type: text/x-diff
Size: 5684 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050214/05a803a1/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: endpos.patch
Type: text/x-diff
Size: 2584 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050214/05a803a1/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mencoder.patch
Type: text/x-diff
Size: 8812 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050214/05a803a1/attachment-0002.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: help_mp-en.patch
Type: text/x-diff
Size: 889 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050214/05a803a1/attachment-0003.patch>


More information about the MPlayer-dev-eng mailing list