[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

transcode - mplex - a/v sync problem



Hi:

Having some trouble here syncing audio/video on dvd creations...

First of all, here's a list of the tools I'm using:
AMD64 sid
jpg-6b (manual compile/install)
lame-3.96-1 (manual compile/install)
mjpegtools-1.8.0 (manual compile/install)
transcode-1.0.0 with diff 6 applied.

I'm using transcode to get from .avi to audio mpeg2 and video ac3 stream files. Then I'm using mplex from the mjpegtools package to try to put them back together again. The only caveat with the install of the above packages, is that mjpegtools-1.8.0 detected my cpu as a "k8" and then gcc crapped out. I changed the return value in the cpuinfo.sh script in that package to return "athlon64" rather than "k8" and it compiled ok, oddly indicating a processor type of athlon-xp. That aside, the package binaries seem to run ok.

So, I took a 4 minute clip from an .avi movie and tried to transcode and mplex it. I tried at least a dozen times with differing switches and changes, and I still can't get the video and audio synced. Here's how it looked:

First, here is my transcode line:

transcode -i movie.avi -y ffmpeg --export_prof dvd-ntsc --export_asr=2 -o movie -m movie.ac3 --export_fps 29.92 -c 00:07:00-00:11:00

transcode v1.0.0 (C) 2001-2003 Thomas Oestreich, 2003-2004 T. Bitterberg
libdvdread: Encrypted DVD support unavailable.
************************************************
**                                            **
**  No css library available. See             **
**  /usr/share/doc/libdvdread3/README.Debian  **
**  for more information.                     **
**                                            **
************************************************
libdvdread: Can't open file VIDEO_TS.IFO.
[transcode] (probe) suggested AV correction -D 0 (0 ms) | AV 0 ms | 0 ms
[transcode] auto-probing source movie.avi (ok)
[transcode] V: import format    | XviD RIFF data, AVI (V=ffmpeg|A=mp3)
[transcode] V: import frame     | 600x352  1.70:1
XXX: zoom=yes pre_clip=yes
[transcode] V: pre clip frame   | 600x468 (-58,0,-58,0)
[transcode] V: zoom             | 720x480  1.99:1 (Lanczos3)
[transcode] V: bits/pixel       | 0.217
[transcode] V: decoding fps,frc | 23.976,1
[transcode] V: Y'CbCr           | YV12/I420
[transcode] A: import format | 0x55 MPEG layer-3 [48000,16,2] 121 kbps [transcode] A: export format | 0x55 MPEG layer-3 [48000,16,2] 128 kbps
[transcode] V: encoding fps,frc | 29.970,4
[transcode] A: bytes per frame  | 6408 (6406.400000)
[transcode] A: adjustment       | -1600@1000
[transcode] V: IA32/AMD64 accel | sse3 (sse3 sse2 sse 3dnowext 3dnow mmxext mmx asm C)
tc_memcpy: using amd64 for memcpy
[transcode] V: video buffer     | 10 @ 720x480
[import_mp3.so] v0.1.4 (2003-08-04) (audio) MPEG
[import_ffmpeg.so] v0.1.12 (2004-05-07) (video) ffmpeg: MS MPEG4v1-3/MPEG4/MJPEG [export_ffmpeg.so] v0.3.13 (2004-08-03) (video) FFmpeg0.4.9-pre1b4756 | (audio) MPEG/AC3/PCM
[import_mp3.so] MP3->PCM
[import_mp3.so] tcextract -a 0 -i "movie.avi" -x mp3 -d 0 | tcdecode -x mp3 -d 0 -z 48000
tc_memcpy: using amd64 for memcpy
[export_ffmpeg.so] Using FFMPEG codec 'mpeg2video' (FourCC 'mpg2', MPEG2 compliant video).
[export_ffmpeg.so]: INFO: Selected dvd profile, ntsc video type for video
[export_ffmpeg.so]: INFO: Set interlacing to bottom-first
[export_ffmpeg.so]: INFO: Set frame rate to 29.97
[export_ffmpeg.so]: INFO: Set video bitrate to 5000
[export_ffmpeg.so]: INFO: Set GOP size to 18
[export_ffmpeg.so] Reading configuration from '/home/bill/.transcode/ffmpeg.cfg' [export_ffmpeg.so] Config section 'mpeg2video' not found in '/home/bill/.transcode/ffmpeg.cfg'
[export_ffmpeg.so]: INFO: Starting 1 thread(s)
[export_ffmpeg.so]: INFO: Display aspect ratio calculated as 1.333333
[export_ffmpeg.so]: INFO: Sample aspect ratio calculated as 0.888889
[export_ffmpeg.so]: INFO: Selected dvd profile for audio
[export_ffmpeg.so]: INFO: Resampling filter inactive
[export_ffmpeg.so]: INFO: Set number of audio channels to 2
[export_ffmpeg.so]: INFO: Set number of audio bits to 16
[export_ffmpeg.so]: INFO: No audio resampling necessary, using 48000 Hz
[export_ffmpeg.so]: INFO: Set audio bit rate to 224 kbps
[export_ffmpeg.so]: INFO: Set audio codec to ac3
skipping frames [000000-010069], 238.34 fps, EMT: 0:06:59, ( 0| 0| 0)
[mpeg2video @ 0x2aaaad4032b0]rc buffer underflow
encoding frame [15823],  29.05 fps, 100.0%, ETA: 0:00:00, ( 0| 0| 8)
clean up | frame threads | unload modules | cancel signal | internal threads | done
[transcode] encoded 5754 frames (0 dropped, 0 cloned), clip length 239.99 s

I've done alot of reading and browsing, and the only thing I see here that might be an issue is the missing call in [import_mp3.so] to tcdemux, which I have seen in an example transcode call I found on a web page example somewhere. Not sure if that's an issue, or if the latest transcode just doesn't need it.
Here's what the mplex call looked like:

mplex -f8 -o movie.mpeg movie.mpeg.ac3 movie.mpeg.m2v
  INFO: [mplex] mplex version 1.8.0 (2.2.4 $Date: 2005/08/28 17:50:54 $)
  INFO: [mplex] File movie.mpeg.ac3 looks like an AC3 Audio stream.
  INFO: [mplex] File movie.mpeg.m2v looks like an MPEG Video stream.
INFO: [mplex] Video stream 0: profile 8 selected - ignoring non-standard options!
  INFO: [mplex] Found 1 audio streams and 1 video streams
  INFO: [mplex] Selecting dvdauthor DVD output profile
  INFO: [mplex] Multiplexing video program stream!
INFO: [mplex] Scanning for header info: AC3 Audio stream 00 (movie.mpeg.ac3)
  INFO: [mplex] AC3 frame size = 896
  INFO: [mplex] AC3 AUDIO STREAM:
  INFO: [mplex] Bit rate       :    28672 bytes/sec (224 kbit/sec)
  INFO: [mplex] Frequency      :     48000 Hz
  INFO: [mplex] Scanning for header info: Video stream e0 (movie.mpeg.m2v)
  INFO: [mplex] VIDEO STREAM: e0
  INFO: [mplex] Frame width     : 720
  INFO: [mplex] Frame height    : 480
  INFO: [mplex] Aspect ratio    : 4:3 display
  INFO: [mplex] Picture rate    : 29.970 frames/sec
  INFO: [mplex] Bit rate        : 9000000 bits/sec
  INFO: [mplex] Vbv buffer size : 229376 bytes
  INFO: [mplex] CSPF            : 0
  INFO: [mplex] SYSTEMS/PROGRAM stream:
  INFO: [mplex] rough-guess multiplexed stream data rate    : 9419800
  INFO: [mplex] target data-rate specified               : 10080000
  INFO: [mplex] Setting specified specified data rate: 10080000
  INFO: [mplex] Run-in Sectors = 89 Video delay = 13019 Audio delay = 16022
  INFO: [mplex] New sequence commences...
  INFO: [mplex] Audio bd: buf=      0 frame=000000 sector=00000000
  INFO: [mplex] Video e0: buf=      0 frame=000000 sector=00000000
  INFO: [mplex] STREAM e0 completed @ frame 5752.
  INFO: [mplex] STREAM bd completed @ frame 5998.
  INFO: [mplex] Multiplex completion at SCR=17244452.
  INFO: [mplex] Audio bd: buf=  14336 frame=005998 sector=00002667
  INFO: [mplex] Video e0: buf=  75005 frame=005752 sector=00027949
  INFO: [mplex] AUDIO_STATISTICS: bd
  INFO: [mplex] Audio stream length 5375104 bytes.
  INFO: [mplex] Frames         :     5999
  INFO: [mplex] BUFFERING min 35 Buf max 2723
  INFO: [mplex] VIDEO_STATISTICS: e0
  INFO: [mplex] Video Stream length:    56280024 bytes
  INFO: [mplex] Sequence headers:      324
  INFO: [mplex] Sequence ends   :        0
  INFO: [mplex] No. Pictures    :     5753
  INFO: [mplex] No. Groups      :      324
  INFO: [mplex] No. I Frames    :      324 avg. size 26712 bytes
  INFO: [mplex] No. P Frames    :     5430 avg. size  8769 bytes
  INFO: [mplex] No. B Frames    :        0 avg. size     0 bytes
  INFO: [mplex] Average bit-rate :  2344800 bits/sec
  INFO: [mplex] Peak bit-rate    :  8533200  bits/sec
  INFO: [mplex] BUFFERING min 16 Buf max 220410
  INFO: [mplex] MUX STATUS: no under-runs detected.

I don't have mplayer installed because all my video tools are console based. I run my system primarily as a server, and prefer not to have an X environment. I've tried the offset parameter to mplex to no avail. I've tried different values with mplex -O; from 3011 (which would make the line:
INFO: [mplex] Run-in Sectors = 89 Video delay = 13019 Audio delay = 16022
match delay = 16022) to numbers that generate "data arriving too late." errors. I've tried the tcprobe utility to get "shift" or sync info, but I don't see any in there.

[tcprobe] MPEG program stream (PS)
[tcprobe] summary for movie.mpeg, (*) = not default, 0 = not detected
import frame size: -g 720x480 [720x576] (*)
    aspect ratio: 4:3 (*)
      frame rate: -f 23.976 [25.000] frc=1 (*)
                  PTS=0.1780, frame_time=41 ms, bitrate=9000 kbps
     audio track: -a 0 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
                  PTS=0.1780, bitrate=224 kbps
                  -D 0 --av_fine_ms 0 (frames & ms) [0] [0]

My best guess from the tcprobe output is that the Point Time Stamp is the same for audio and video, which would tend to infer that it is out of sync prior to being separated with transcode... maybe?

Despite all my efforts, these streams aren't getting synced, they are roughly 1m20s out. Yes, 80 seconds. The audio is lagging behind the video.

Any DVD authoring gurus have any sage advice?

Thanks.



Reply to: