All pastes #2097568 Raw Edit

Miscellany

public text v1 · immutable
#2097568 ·published 2011-12-30 23:47 UTC
rendered paste body
Setup.

i7 920/6gb dd3 / Dveo Dvb Master ASI Tx card.
Input: variable sources
Output: MpegTs File or Pipe
Playback: vlc 1.3git, ffplay,  Tandberg-TT1260 Hardware Reciever

Test file: http://www.pxn.ca/avsync.zip

ffmpeg version N-36249-g6ed3565, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 30 2011 13:40:11 with gcc 4.6.1
  configuration: --enable-shared --enable-pic --enable-gpl --enable-postproc --enable-swscale --enable-pthreads --enable-x11grab --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-version3 --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-librtmp --enable-debug
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 49.100 / 53. 49.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 55.100 /  2. 55.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100


x264 0.120.2120 0c7dab9
(libswscale 2.1.100)
(libavformat 53.29.100)
built on Dec 30 2011, gcc: 4.6.1
configuration: --bit-depth=8 --chroma-format=all


Goal: Audio Sync using ac3 2ch 48000hz 192kbps
Problem: Ac3 Stereo Audio Sync with different samples rates or bit rates do not sync right on Hardware decoder.
The audio seems to be ahead of the video maybe upto 500ms, the colorbars clip shows it well on hardware, software not so much.
The same clips however appear to be fine in ffplay or vlc, which is not going to help testing this.

If I use mp2 audio all is well.
Using ac3:
If I I change the bit rate down to 96kbps or 56kbps I get sync on hardware decoder, 128 and 192 are out.
If I change the sample rate down to 44100 I get sync.

I have a feeling one of the tables is untested at 48000hz maybe resulting in an offset in pts and dts?
^an odd guess haven't dug in enough yet. 



ffmpeg  -i $1   -threads 8 \
-vcodec mpeg2video -aspect 4:3 -s 576x480 -r 30000/1001 -b:v 3748800 -sameq \
-minrate 3748800 -maxrate 3748800 -bufsize 1120000 -muxrate 4334880 \
-acodec ac3 -ac 2 -ar XXX -b:a XXX  -packetsize 188 \
-strict very \
-f mpegts



44100 @ 32kb
-Tone in sync, but changes in pitch, cuts out/not stable.

44100 @ 40kb, 48kb,56kb, 64kb, 80kb, 96kb, 112kb,128kb,160kb,192kb,224kb 
-Tone in sync, tone stable.

Unsure of my overhead to test higher with the same settings.


48000 @ 32kb, 40kb, 48kb, 56kb
-Tone in sync, tone stable.

48000 @ 64kb
-Tone NOT in sync, marginal, audio appears to be ahead of video 1-200ms, tone stable.

48000 @ 80kb, 96kb
-Tone in sync, tone stable.

48000 @ 112kb, 128kb, 160kb,
-Tone NOT in sync, marginal, audio appears to be ahead of video 1-200ms, tone stable.

48000 @ 192kb,
-Tone NOT in sync, large drift, audio appears to be ahead of video 500ms-1sec, tone stable.

48000 @ 80kb, 224kb
-Tone in sync, tone stable. 


Arg, weird.
Anyone with a broadcast hardware decoder reproduce?
Hopefully the report above may help fix others as well if it is off values in tables.