Skip to contentSkip to conversation

dvb mpeg2?

linux-dvb Tim Farrington 2 participants 5 messages Jul 24, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi all,

Got there:

Filetype is MPEG2-TS (generic PES Container)

Need to use mplayer, projectx to ascertain this.

This is what I have just done to achieve an a/v sync perfect, edited, recorded dvb file:

1. Run file through project-x; divides files into *.mp2 (MPEG audio stream), *.m2v (video stream),
(plus for HDTV *.ac3 (for Dolby Digital aka AC3 stream))
projectx rec-file.mpeg => rec-file.m2v rec-file.mp2

2. Run *.mp2 *.m2v through mplex to recombine into PS format mplex -f 8 -o rec-file-a.mpeg rec-file.m2v rec-file.mp2 => rec-file-a.mpeg

3. Edit resultant file with avidemux on I-Frames while retaining a/v sync => rec-file-a-a.mpeg

And it produces a perfect new file!

My huge thanks to you all for your assistance.

Regards,
Tim Farrington

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#1 lore raw
Quoted 23 lines · On Thursday 24 July 2008 15:43:28 Tim Farrington wrote:

Hi all,

Got there:

Filetype is MPEG2-TS (generic PES Container)

Need to use mplayer, projectx to ascertain this.

This is what I have just done to achieve an a/v sync perfect, edited, recorded dvb file:

1. Run file through project-x; divides files into *.mp2 (MPEG audio stream), *.m2v (video stream),
(plus for HDTV *.ac3 (for Dolby Digital aka AC3 stream))
projectx rec-file.mpeg => rec-file.m2v rec-file.mp2

2. Run *.mp2 *.m2v through mplex to recombine into PS format mplex -f 8 -o rec-file-a.mpeg rec-file.m2v rec-file.mp2 => rec-file-a.mpeg

3. Edit resultant file with avidemux on I-Frames while retaining a/v sync => rec-file-a-a.mpeg

Quoted 6 lines

And it produces a perfect new file!

My huge thanks to you all for your assistance.

Regards,
Tim Farrington

be aware that demuxing the TS in its elementary streams implicitly drops all timestamps (that are recorded in the PES headers), thus recombining the audio and video streams will produce a desynchronized output, unless you are lucky.
There simply aren't enough informations to keep synchrony without timestamps. With your method if a stream is corrupt
you will likely see a desynchronization from the first breakage onward, while working on the TS the muxer has a chance to recover

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#2 lore raw
Quoted 10 lines · On Thursday 24 July 2008 15:57:06 Nico Sabbi wrote:

be aware that demuxing the TS in its elementary streams implicitly drops all timestamps (that are recorded in the PES headers), thus recombining the audio and video streams will produce a desynchronized output, unless you are lucky.
There simply aren't enough informations to keep synchrony without timestamps. With your method if a stream is corrupt
you will likely see a desynchronization from the first breakage onward, while working on the TS the muxer has a chance to recover

BTW, although mencoder is broken in countless respects, generating an mpeg-ps is quite safe:

$ mencoder -demuxer lavf -of mpeg -mpegopts format=dvd -oac copy -ovc 
copy -o output.mpg input.ts 

eventually dropping -demuxer lavf if it doesn't work (lavf's demuxer isn't nearly as permissive as my native TS demuxer (the default one) but it has an advantage: strictly correct timestamps on all frames)

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#3 lore raw
Quoted 20 lines · Nico Sabbi
Quoted 10 lines · On Thursday 24 July 2008 15:57:06 Nico Sabbi wrote:

be aware that demuxing the TS in its elementary streams implicitly drops all timestamps (that are recorded in the PES headers), thus recombining the audio and video streams will produce a desynchronized output, unless you are lucky.
There simply aren't enough informations to keep synchrony without timestamps. With your method if a stream is corrupt
you will likely see a desynchronization from the first breakage onward, while working on the TS the muxer has a chance to recover

BTW, although mencoder is broken in countless respects, generating an mpeg-ps is quite safe:

$ mencoder -demuxer lavf -of mpeg -mpegopts format=dvd -oac copy -ovc 
copy -o output.mpg input.ts 
Quoted 10 lines

eventually dropping -demuxer lavf if it doesn't work (lavf's demuxer isn't nearly as permissive as my native TS demuxer (the default one) but it has an advantage: strictly correct timestamps on all frames)

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Hi Nico,
Yes I wondered about corrupt streams, so I watched projectx in action carefully.
I need to understand it a bit more, but it found many corrupt timestamps while demuxing, and repaired on the run. Time will tell, however I have some progress,
and I can't fault the process yet!

I intend to try all of everybody's suggestions. One question - with mencoder why format=dvd?

Regards,
Timf

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

#4 lore raw
Quoted 8 lines · On Thursday 24 July 2008 16:13:22 Tim Farrington wrote:

Hi Nico,
Yes I wondered about corrupt streams, so I watched projectx in action carefully.
I need to understand it a bit more, but it found many corrupt timestamps while demuxing, and repaired on the run. Time will tell, however I have some progress,
and I can't fault the process yet!

Quoted 5 lines

I intend to try all of everybody's suggestions. One question - with mencoder why format=dvd?

Regards,
Timf

because the default is mpeg2, with too many restrictions on the
muxrate and because sooner or later you will want to burn to dvd.
The muxrate is a bit higher, but who cares? :)
Otherwise you can use -of mpeg -mpegopts format=mpeg2:muxrate=10800 or something like that

_______________________________________________
linux-dvb mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb