[MEncoder-users] How to change the audio timestamps
Jorge Peixoto de Morais Neto
please.no.spam.here at gmail.com
Tue May 27 05:30:16 CEST 2008
When I capture video from my TV card, I get a huge number of
duplicated frames and skipped frames. To avoid it, I use the option
noskip. But then a weird problem happens: a steadily increasing delay
between the audio and the video. I can work around it by extracting
the audio as pcm, applying the "tempo" sox effect to make the audio
0.1% longer, compress (with vorbis), and remux.
However, I don't like the idea of irreversibly changing the PCM audio
before encoding to vorbis. Can I make a "soft tempo" with mencoder?
Or, can I avoid this 0.1% discrepancy in the first place?
May this 0.1% discrepancy have anything to do with the famous 0.1%
difference between the "natural" framerate of 30 and the real
framerate of 30 / 1.001?
About the skipped/duplicated frames: another poster suggested me to
mess with .asoundrc, but I have not yet studied ALSA. So messing with
.asoundrc may (or may not) solve my skipped/duplicated frames problem
in the future, but I already have video with a 0.1% sync discrepancy
A quick example of the duplicate frames and skipped frames I get when
I omit noskip:
jorge at jorge ~/tmp $ mencoder -profile illtv -o teste.avi -endpos 5 tv://Escola
MEncoder dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2008 MPlayer Team
CPU: AMD Athlon(tm) XP 2600+ (Family: 6, Model: 8, Stepping: 1)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE
success: format: 9 data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
name: Video 4 Linux 2 input
author: Martin Olschewski <olschewski at zpr.uni-koeln.de>
comment: first try, more to come ;-)
Selected device: BT878 video (Prolink PixelView
Tuner cap:
Tuner rxs: MONO
Capabilites: video capture video overlay VBI capture device tuner
read/write streaming
supported norms: 0 = PAL; 1 = NTSC; 2 = SECAM; 3 = PAL-Nc; 4 = PAL-M;
5 = PAL-N; 6 = NTSC-JP; 7 = PAL-60;
inputs: 0 = Television; 1 = Composite1; 2 = S-Video;
Current input: 0
Current format: YVU420
v4l2: current audio mode is : MONO
TV channel names detected.
Selected channel: 15 - Escola (freq: 127.250)
[V] filefmt:9 fourcc:0x32315659 size:640x480 fps:29.970 ftime:=0.0334
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [crop w=624 h=464 x=0]
Crop: 624 x 464, 0 ; -1
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
videocodec: libavcodec (624x464 fourcc=48564646 [FFVH])
Selected video codec: [rawyv12] vfm: raw (RAW YV12)
==========================================================================
audiocodec: framecopy (format=1 chans=1 rate=44100 bits=16 B/s=88200 sample-2)
Forcing audio preload to 0, max pts correction to 0.
Writing header...1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
Pos: 0.1s 2f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 0.1s 4f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 0.4s 13f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos: 0.7s 21f ( 0%) 17.56fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 0.8s 26f ( 0%) 20.67fps Trem: 0min 0mb A-V:0.000 [0:0]
1 duplicate frame(s)!
Pos: 0.9s 28f ( 0%) 21.82fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 1.0s 32f ( 0%) 24.17fps Trem: 0min 0mb A-V:0.000 [61231:0]
Skipping frame!
Pos: 1.0s 33f ( 0%) 20.26fps Trem: 0min 0mb A-V:0.000 [61231:705]
Skipping frame!
Pos: 1.2s 39f ( 0%) 23.04fps Trem: 0min 0mb A-V:0.000 [61682:705]
1 duplicate frame(s)!
Pos: 1.3s 41f ( 0%) 23.85fps Trem: 0min 0mb A-V:0.000 [60266:705]
Skipping frame!
Pos: 1.3s 43f ( 0%) 24.78fps Trem: 0min 0mb A-V:0.000 [60381:705]
1 duplicate frame(s)!
Pos: 1.4s 45f ( 0%) 25.54fps Trem: 0min 0mb A-V:0.000 [59169:705]
1 duplicate frame(s)!
Pos: 1.5s 48f ( 0%) 22.30fps Trem: 0min 0mb A-V:0.000 [58274:705]
Skipping frame!
Pos: 1.5s 49f ( 0%) 22.75fps Trem: 0min 0mb A-V:0.000 [58274:705]
Skipping frame!
Pos: 1.7s 56f ( 0%) 25.06fps Trem: 0min 0mb A-V:0.000 [59144:705]
1 duplicate frame(s)!
Pos: 1.8s 57f ( 0%) 25.36fps Trem: 0min 0mb A-V:0.000 [58172:705]
1 duplicate frame(s)!
Pos: 1.9s 59f ( 0%) 25.98fps Trem: 0min 0mb A-V:0.000 [57429:705]
1 duplicate frame(s)!
Pos: 2.1s 63f ( 0%) 23.55fps Trem: 0min 0mb A-V:0.000 [57056:705]
1 duplicate frame(s)!
Pos: 2.1s 64f ( 0%) 23.81fps Trem: 0min 0mb A-V:0.000 [56308:705]
1 duplicate frame(s)!
Pos: 2.2s 66f ( 0%) 24.31fps Trem: 0min 0mb A-V:0.000 [55778:705]
1 duplicate frame(s)!
Pos: 2.5s 72f ( 0%) 25.80fps Trem: 0min 0mb A-V:0.000 [56005:705]
1 duplicate frame(s)!
Pos: 2.5s 73f ( 0%) 26.03fps Trem: 0min 0mb A-V:0.000 [55406:705]
1 duplicate frame(s)!
Pos: 2.6s 75f ( 0%) 23.82fps Trem: 0min 0mb A-V:0.000 [54971:705]
1 duplicate frame(s)!
Pos: 2.7s 77f ( 0%) 24.28fps Trem: 0min 0mb A-V:0.000 [54538:705]
1 duplicate frame(s)!
Pos: 2.9s 80f ( 0%) 24.93fps Trem: 0min 0mb A-V:0.000 [54193:705]
Skipping frame!
Pos: 2.9s 82f ( 0%) 25.43fps Trem: 0min 0mb A-V:0.000 [54300:705]
Skipping frame!
Pos: 2.9s 83f ( 0%) 25.71fps Trem: 0min 0mb A-V:0.000 [54300:705]
Skipping frame!
Pos: 2.9s 85f ( 0%) 25.87fps Trem: 0min 0mb A-V:0.000 [54410:705]
Skipping frame!
Pos: 3.0s 87f ( 0%) 26.29fps Trem: 0min 0mb A-V:0.000 [54516:705]
Skipping frame!
Pos: 3.0s 90f ( 0%) 24.56fps Trem: 0min 0mb A-V:0.000 [54729:705]
1 duplicate frame(s)!
Pos: 3.3s 96f ( 0%) 25.71fps Trem: 0min 0mb A-V:0.000 [54739:705]
1 duplicate frame(s)!
Pos: 3.4s 99f ( 0%) 26.24fps Trem: 0min 0mb A-V:0.000 [54481:705]
Skipping frame!
Pos: 3.4s 101f ( 0%) 26.66fps Trem: 0min 0mb A-V:0.000 [54585:705]
Skipping frame!
Pos: 3.4s 102f ( 0%) 26.91fps Trem: 0min 0mb A-V:0.000 [54585:705]
Skipping frame!
Pos: 3.5s 104f ( 0%) 27.34fps Trem: 0min 0mb A-V:0.000 [54677:705]
Skipping frame!
Pos: 3.5s 106f ( 0%) 27.76fps Trem: 0min 0mb A-V:0.000 [54765:705]
Skipping frame!
Pos: 3.5s 107f ( 0%) 25.81fps Trem: 0min 0mb A-V:0.000 [54765:705]
Skipping frame!
Pos: 3.5s 109f ( 0%) 26.21fps Trem: 0min 0mb A-V:0.000 [54857:705]
1 duplicate frame(s)!
Pos: 3.6s 111f ( 0%) 26.52fps Trem: 0min 0mb A-V:0.000 [54528:705]
1 duplicate frame(s)!
Pos: 4.0s 120f ( 0%) 27.90fps Trem: 0min 0mb A-V:0.000 [54962:705]
1 duplicate frame(s)!
Pos: 4.2s 127f ( 0%) 26.92fps Trem: 0min 0mb A-V:0.000 [55362:705]
1 duplicate frame(s)!
Pos: 4.3s 128f ( 0%) 27.06fps Trem: 0min 0mb A-V:0.000 [55050:705]
1 duplicate frame(s)!
Pos: 4.4s 130f ( 0%) 27.32fps Trem: 0min 0mb A-V:0.000 [54867:705]
1 duplicate frame(s)!
Pos: 4.5s 132f ( 0%) 27.60fps Trem: 0min 0mb A-V:0.000 [54690:705]
1 duplicate frame(s)!
Pos: 4.6s 133f ( 0%) 25.92fps Trem: 0min 0mb A-V:0.000 [54405:705]
1 duplicate frame(s)!
Pos: 4.7s 135f ( 0%) 26.17fps Trem: 0min 0mb A-V:0.000 [54233:705]
1 duplicate frame(s)!
Pos: 4.8s 137f ( 0%) 26.39fps Trem: 0min 0mb A-V:0.000 [54066:705]
1 duplicate frame(s)!
Pos: 4.9s 140f ( 0%) 26.75fps Trem: 0min 0mb A-V:0.000 [53952:705]
Skipping frame!
Pos: 5.0s 143f ( 0%) 27.18fps Trem: 0min 0mb A-V:0.000 [54094:705]
1 duplicate frame(s)!
Pos: 5.0s 144f ( 0%) 27.31fps Trem: 0min 0mb A-V:0.000 [53805:705]
Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not
writing vprp header.
Video stream: 53805.227 kbit/s (6725653 B/s) size: 33886308 bytes
5.038 secs 144 frames
Audio stream: 705.600 kbit/s (88200 B/s) size: 441000 bytes 5.000 secs
v4l2: 156 frames successfully processed, 0 frames dropped.
--
Software is like sex: it is better when it is free - Linus Torvalds
More information about the MEncoder-users
mailing list