[MEncoder-users] Accuracy of the -endpos option

Josef Wolf jw at raven.inka.de
Tue Jun 29 14:37:32 CEST 2010


On Mon, Jun 28, 2010 at 10:32:24PM +0200, belcampo wrote:
> Josef Wolf wrote:
> >On Mon, Jun 28, 2010 at 04:38:29PM +0200, belcampo wrote:
> >>Josef Wolf wrote:
> >>>Hello,
> >>>
> >>>I have troubles with the accuracy of the -endpos option. Most of the time,
> >>>I get about 40 to 50 frames too much. When I adjust the value to get the
> >>>correct end position, then audio ends about 2 seconds too early.
> >>With ffmpeg -vframes ### you can exactly say how many frames you want.
> >>The problem with -endpos or -t when using ffmpeg, it uses recording
> >>duration, NOT video- or audio-duration but the smallest of them.
> >
> >Hmmm... Does mencoder have a counterpart to -vframes? I have gone a long way
> >to optimize the codec settings for mencoder and would like to avoid to start
> >from scratch when moving to ffmpeg...
> If you post your command line settings, maybe it's easy translated
> to ffmpeg, or use the solution explained further.

Sure, I can post them:

  mencoder \
  -ss 00:00:01.880 -endpos 241.92 \
  -vf yadif=0,crop=704:560:8:8,softskip,harddup \
  -oac mp3lame -lameopts preset=medium -passlogfile \
  -ovc x264 -x264encopts \
  bitrate=800:pass=2:subq=7:frameref=15:me=umh:partitions=all:8x8dct:direct_pred=auto:me_range=64:trellis=2:bframes=5:weight_b:threads=auto:nr=1000:b_pyramid=normal:turbo=2 \
  -passlogfile x264-800/2010-05-08-Tanz-Jan-3-Tanz.avi.log \
  -o x264-800/2010-05-08-Tanz-Jan-3-Tanz.avi \
  2010-05-09-Tanz-Jan008.avi

Whatever I tried, I get much bigger files with very bad quality from ffmpeg.

> >>>The problem doesn't seem to be dependant on the source material or the
> >>>codec. I had the problem with ljpeg and DV source (which should both be
> >>>searchable on a frame-by-frame bassis). Using lavc instead of x264 don'
> >>>help either.
> >>Is DV source all-keyframes ??
> >
> >At least, the -ss option is precise for both, ljpeg and DV. BTW: While I can
> >see reasons for -ss to position only on keyframes, I don't see why -endpos
> >would require such a restriction.
> A movie, which is a container, video-stream and an audio-stream.
> Video- and audio-stream are not always, mostly not in sync. In the
> container is info about the delay, in such a way that a player,
> knows what audio-segment belongs to what video-segment. These can,
> and are, sometimes be 1 second apart. As an example video starts at
> byte-point 0, in the audio stream there is a silence of 1 sec. When
> playing of the first frame starts, the corresponding audio ####bytes
> further in the stream is then matched with the video and everything
> plays well.
> Video-duration = Audio-duration, but file-duration is longer. The
> -endpos takes the latest ending-point of audio or video, and adds
> non-wanted stuff as you've noticed.
> There's a workaround, by doing it in 2 steps, audio and video apart.

So demuxing, encoding/snipping, and muxing afterwards should also work fine?
Last time I tried, mencoder refused to process a video stream without audio or
an audio stream without video.


More information about the MEncoder-users mailing list