[mythtv] audio and video syncing

Craig Longman craigl at begeek.com
Sat May 24 16:13:05 EDT 2003


in the process of handling the cutlists while transcoding, i'm running 
into a few questions that i can't answer about syncing up audio and 
video, and i'd like some help please.  now, this is based on information 
i'm seeing as NuppleVideoPlayer presents it to me, so maybe the question 
is more about NuppleVideoPlayer than file formats.

i guess, first off.  is there any direct (or required) link between the 
video frame read and the audio frame read?  i notice that there are 
frequently frames read that have no audio data., and the video is 
generally ahead of the audio by as many as 8 or 10 frames.  when i'm 
parsing out the frames that need to be transcoded, i will have to read 
ahead frequently to catch all the audio that is related to the last 
frame i'm writing out, before fast forwarding, so this might mean i 
write out an audio frame of over 64K, with no video frame written 
potentially.  and then 8 to 10 video frames before i get any relevant 
audio again.  does this make sense?  hopefully, and then here are my 
questions:

is there a maximum that the difference in timecodes between audio and 
video can be?  and is there are hard limit and a realistic limit?

is there a maximum amount of audio data i can write in a single call to 
WriteAudio()?  and/or can i call WriteAudio() multiple times before 
calling WriteVideo()?

if i've explained anything badly, please lemme know and i'll try and 
clarify.  below is a dump from reading in a capture that i'm looking at 
as an eg.  the format is as such:

{frame-number}: {video-timecode} [ - {audio-timecode} ({audio-framesize}) ]

from the dump, you can see that if i wanted to cut from frame 19 out, i 
would still have to suck the audio in all the way up to frame 29.  and 
then if i wanted to start append from frame 48 again, there would not be 
audio with the right timecode until frame 58 (and even then, only the 
last half or so of the packet).  at least, that's how i'm interpreting 
these values.

1: 433
2: 466
3: 499
4: 533
5: 566
6: 599
7: 633
8: 666 - 333 (4608)
9: 699
10: 734
11: 767 - 381 (9216)
12: 800 - 429 (9216)
13: 834 - 477 (13824)
14: 867
15: 900 - 549 (9216)
16: 934 - 597 (9216)
17: 967 - 645 (4608)
18: 1000 - 669 (9216)
19: 1034
20: 1067 - 717 (9216)
21: 1100 - 765 (9216)
22: 1134 - 813 (4608)
23: 1167 - 837 (9216)
24: 1200
25: 1234
26: 1267 - 885 (9216)
27: 1300 - 933 (9216)
28: 1334 - 981 (4608)
29: 1367 - 1005 (9216)
30: 1400 - 1053 (9216)
31: 1434 - 1101 (9216)
32: 1467 - 1149 (4608)
33: 1500
34: 1534 - 1173 (9216)
35: 1567 - 1221 (9216)
36: 1600 - 1269 (9216)
37: 1635 - 1317 (4608)
38: 1668
39: 1701 - 1341 (9216)
40: 1735
41: 1768 - 1389 (9216)
42: 1801 - 1437 (9216)
43: 1835 - 1485 (4608)
44: 1868 - 1509 (9216)
45: 1901 - 1557 (9216)
46: 1935 - 1605 (9216)
47: 1968 - 1653 (4608)
48: 2001
49: 2035 - 1677 (9216)
50: 2068 - 1725 (9216)
51: 2101 - 1773 (9216)
52: 2135 - 1821 (4608)
53: 2168
54: 2201 - 1845 (9216)
55: 2235
56: 2268 - 1893 (9216)
57: 2301 - 1941 (9216)
58: 2335 - 1989 (4608)
59: 2368 - 2013 (9216)
60: 2401 - 2061 (9216)




More information about the mythtv-dev mailing list