Mailing List archive

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

[linux-dvb] Sync vdr streams into vob/mpg perfectly with PVAStrumento



Hello,

In the last days I had this problem you're discussing about these days
with a/v not in sync after mplex'ing them into vob/mpeg2-program streams.

I analyzed it with several programs and now I really know a much more
about mpeg streams and why mplex cannot give the right result in any
case.

First I describe what's going on with mplex, then you can read what the
solution is: It's called PVAStrumento (somebody mentioned it in this
mailinglist some days ago - thanks!) and IS a GREAT program.

What a pity that mplex hasn't the option to behave like PVAStrumento
(one couldn't say that mplex has an "error", it only throws some info
about the relationship between video and audio away when demuxing).

Depending on how many nights you tried to make this sync thing work
(like me), you can more or less understand why I'm so glad about
finding this tool.. ;)

PVAStrumento is freeware and can be found on http://www.offeryn.de.



--what mplex does (depending on analyzing the output, not the sourcecode)--
--in german, sorry, i wrote this to a friend and don't want to--
--translate it now. and sorry if it's technically not 100% correct--


So scheint es vereinfacht zu sein (zusätzlich zum Vorkommen von zu
vielen oder zu wenigen packages wie hier beschrieben können wohl auch
noch defekte, nicht verwertbare packages auftauchen, aber das
vernachlässige ich mal hier):



***Übertragung (mit Unregularitäten)***

       a1  a2 a3a4 a5  a6  a7      a8  a9
SCR ---1---2---3---4---5---6---7---8---9---
       v1  v2  v3  v4  v5      v6  v7  v8

SCR=System Clock Reference
ax=Audio-packet
vx=video-packet

Es werden also diverse Audio- und Video-Pakete übertragen, die alle
einen Timecode beinhalten und dann entsprechende der SCR passend vom
Player später wiedergegeben werden müssen.
Oben habe ich die Pakete so angeordnet, zu wessen Zeitpunkt sie laut
Timecode gehören.

Status: OK, da ja die Timecodes im Strom stehen, auch wenn es
        unregelmäßige Anzahlen von packages sind.



***Wiedergabe Player (z.b. vdr)***

       a1  a2  a3  a5  a6  a7  a7  a8  a9
SCR ---1---2---3---4---5---6---7---8---9---
       v1  v2  v3  v4  v5  v5  v6  v7  v8

Der Player beachtet die Timecodes der Pakete und sorgt dafür, daß sie
zum richtigen Zeitpunkt wiedergegeben werden.
Wenn eins fehlt, wird das alte Paket nochmal wiedergegeben (bzw. Bild
nochmal angezeigt), wenn eins zuviel ist, wird es verworfen.
(Zumindest wäre dies eine einfache Möglichkeit, wenn man einen Player
schreiben sollte, vielleicht interpolieren die Player noch
intelligenter, aber hier egal.)

Status: A/V-Synchro paßt! (sofern Player ok)



***Demux der elementary Streams mit mpegtools***
***bzw. Demux als erster Schritt von mplex***

       a1  a2 a3a4 a5  a6  a7      a8  a9
SCR ---1---2---3---4---5---6---7---8---9---
       v1  v2  v3  v4  v5      v6  v7  v8

 => a1,a2,a3,a4,a5,a6,a7,a8,a9
 => v1,v2,v3,v4,v5,v6,v7,v8

Zeitcodes werden nicht beachtet, da sie auch in elementary streams
nicht mehr stehen. Außerdem werden nicht wie beim Player packages
verdoppelt oder verworfen.

Status: Hmm, alleine betrachtet sind die Streams verwendbar, aber es
        geht jeglicher Bezug zueinander verloren.



***neues multiplexen als zweiter Schritt von mplex***

a1,a2,a3,a4,a5,a6,a7,a8,a9 =>
v1,v2,v3,v4,v5,v6,v7,v8    =>

       a1  a2  a3  a4  a5  a6  a7  a8  a9
SCR ---1---2---3---4---5---6---7---8---9---
       v1  v2  v3  v4  v5  v6  v7  v8


Die pakete werden einfach aneinandergereiht (einzige Möglichkeit, da
keine Timecodes in den quell-elementary streams stehen).

Status: A/V-Synchro falsch!




----------------PVAStrumento doc------------------
Why "yet another converter" ?
Already there exist a few solutions to convert from PVA to MPEG2 PS,
some offered by the manufactures of the cards themselves. So why create
yet another converter ?

The necessity arose because the author regularly converts the captured
DVB-streams to lower bitrate streams, that may be fitted on an SVCD to
be played by a standalone player. That may change, as DVD-R get in the
authors price-range, but until then, the MPEG2 PS have to be transcoded.

Transcoding is sensitive to errors in the MPEG2 PS. As the recorded data
come from transport streams they are prone to errors and a convertor has
to be very sensitive in the way it deals with them. Though software
players on a PC are usually forgiving with errors, MPEG2 encoders will
generally run into troubles. With PVAStrumento it was the intend to get
a converter that gracefully corrects errors in the input stream.

More importantly during transcoding the PTS are lost in many
circumstances. Converting from PVA (or TS) to MPEG2 PS leaves the PTS in
the packetized elementary streams (PES). Therefore, if there are any
errors in the received data, like missing or corrupted audio blocks,
audio and video will still be "in sync", as the player knows exactly,
when to present the A/V chunks. But many tools used for transcoding
ignore the PTS information. And when you wantto create (S)VCD compliant
files, you generally have to re-mux the MPEG2 PS, as (S)VCD expects a
special packet size of 2324 Bytes. Re-Muxing involves seperating the
elementary streams from the program stream and interleaving them to a
new program stream. During seperating toos usually generate ES
(elementary streams), that have no timing information. Now - when you
re-mux this streams, a missing or corrupted A/V block will lead to
de-synchronization of audio and video. PVAStrumento aims at this problem
by generating audio and video ES in the output, that will have the same
"length" - timing wise, and PTS information in the generated MPEG2 PS is
calculated on the basis of the validated streams.

PVAStrumento is another PVA-to-MPEG converter, but it is specifically
geared to the needs of transcoding and SVCD-production.
----------------PVAStrumento doc------------------

Have phun with this great freeware tool!


cu, Uwe.

** Homepage: http://www.bigfoot.com/~uwe.freese **



--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index