Page 1 of 1

demux MPEG2 TS and transcode

Posted: 04 Mar 2010 13:33
by weeraman
Hi,
Is there a way to demux a MPEG 2 TS containing many programs.
So that I can transcode each of the programs independently ?

does VLC supports this Please ?

Thanks!

Re: demux MPEG2 TS and transcode

Posted: 12 Mar 2010 07:46
by weeraman
after some searching able to find that VLC can do this :)

I'm yet to try this, (it takes bit of a time to prepare the TS stream) meanwhile could you check the code that i'll be using,

below code works fine for me

Code: Select all

vlc -d udp://@:5008 --marq-marquee VAS TEST --sout '#transcode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100}:rtp{dst=10.48.233.38,port-video=7190,port-audio=7192,sdp=file:///home/vlcsdp/ITN.sdp}'
I need to use the same with 'select' option

Code: Select all

vlc -d udp://@:5008 --sout '#transcode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100, select="program=102"}:rtp{dst=10.48.233.38,port-video=7190,port-audio=7192,sdp=file:///home/vlcsdp/ITN.sdp}'
please check whether this is ok


thanks

!

Posted: 16 Mar 2010 08:23
by weeraman
the above command doesn't work :oops:

anyway i went through some of the past posts and streaming guide. Found that to select a program (using select="program=100") i need to use the duplicate module at my output.
However with duplicate module i'm unable to use the transocde module

below is the code i've tested, need your help to solve this ! (under Windows)

Code: Select all

:sout=#duplicate{dst="trasncode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100}:rtp{dst=10.48.233.38,port-video=7230,port-audio=7232,sdp=file://c:\vlcsdp\demux.sdp}","select=program=102"}
produces
main debug: adding playlist item `udp://@:5020' ( udp://@:5020 )
main debug: creating new input thread
main debug: waiting for thread completion
main debug: thread 4092 (input) created at priority 1 (input/input.c:265)
main debug: stream=`duplicate'
main debug: looking for sout stream module: 1 candidate
stream_out_duplicate debug: creating 'duplicate'
stream_out_duplicate debug: * adding `trasncode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100}'
main debug: stream=`trasncode'
main debug: looking for sout stream module: 0 candidates
main error: no sout stream module matched "trasncode"
main debug: destroying chain... (name=trasncode)
main debug: destroying chain done
stream_out_duplicate error: no destination given
main warning: no sout stream module matching "duplicate" could be loaded
main debug: destroying chain... (name=duplicate)
main debug: destroying chain done
main error: stream chain failed for `duplicate{dst=trasncode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100}:rtp{dst=10.48.233.38,port-video=7230,port-audio=7232,sdp=file://c:\vlcsdp\demux.sdp},select=program=102}'
main error: cannot start stream output instance, aborting
main debug: thread times: real 0m0.109375s, kernel 0m0.000000s, user 0m0.000000s
main debug: thread 4092 joined (input/input.c:412)
main: nothing to play
please advice

thanks

Re: demux MPEG2 TS and transcode

Posted: 16 Mar 2010 10:38
by weeraman
above has some spelling mistakes, however it still produces the same error..

no sout stream module matching "transcode" could be loaded -- but the transcode module is a standard stream out module right ? ( i looked in the preferences in GUI and it also shows that transcode module is there at stream out)

need some advice friends..
main debug: adding playlist item `udp://@:5020' ( udp://@:5020 )
main debug: creating new input thread
main debug: waiting for thread completion
main debug: thread 4300 (input) created at priority 1 (input/input.c:265)
main debug: stream=`duplicate'
main debug: looking for sout stream module: 1 candidate
stream_out_duplicate debug: creating 'duplicate'
stream_out_duplicate debug: * adding `transcode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100}'
main debug: stream=`transcode'
main debug: looking for sout stream module: 1 candidate
main error: invalid chain
stream_out_transcode error: cannot create chain
main warning: no sout stream module matching "transcode" could be loaded
main debug: destroying chain... (name=transcode)
main debug: destroying chain done
stream_out_duplicate error: no destination given
main warning: no sout stream module matching "duplicate" could be loaded
main debug: destroying chain... (name=duplicate)
main debug: destroying chain done
main error: stream chain failed for `duplicate{dst=transcode{vcodec=mp4v,width=320,height=240,vb=350,acodec=mp4a,ab=64,channels=2,samplerate=44100},rtp{dst=10.48.233.38,port-video=7230,port-audio=7232,sdp=file://c:\vlcsdp\demux.sdp},select=program=102}'
main error: cannot start stream output instance, aborting
main debug: thread times: real 0m0.125000s, kernel 0m0.000000s, user 0m0.015625s
main debug: thread 4300 joined (input/input.c:412)
main: nothing to play

Re: demux MPEG2 TS and transcode

Posted: 16 Mar 2010 11:23
by Drain Pipe
I can't help you regarding demuxing with VLC however there is a great little Java app called ProjectX (see here: http://www.videohelp.com/tools/ProjectX and here: http://sourceforge.net/projects/project-x/) that can demux MPEG2 TS. It is very good because a lot of programs that demux TS files can leave the audio and video files out of sync. ProjectX is noted for its ability to keep the results in sync.

After you've demuxed with ProjectX you'll have to remux the two seperate audio and video files into what ever format you want. I use Avidemux for that.

I'm not sure what you mean when you say "MPEG 2 TS containing many programs". I think you mean you have one continuous TS file with a couple of programs, broadcast one after the other in sequence.

If that's the case I would save a remux (of the ProjectX demuxed files) in Avidemux as MPEG-PS with no re-encoding. This shouldn't take long because there's no re-encoding. Now you'll have an mpeg file that you can reload in to Avidemux and cut up into each separate program (It seems clunky but I am pretty sure you have to save the MPEG-PS first and then reload it before you can cut it up into separate programs) You can re-encode them with Avidemux or try HandBrake if its H.264 is what your after.

There is a bit of a tutorial that covers some of the points above here: http://forum.doom9.org/showthread.php?t=149827

Sorry if you specifically need to use VLC.

Oh, yeah, another app that I think can demux MEPG2 TS files is MPEG Streamclip http://www.squared5.com/. I haven't used it so I am not sure about it but you could also try that.

Re: demux MPEG2 TS and transcode

Posted: 16 Mar 2010 12:11
by weeraman
Thanks Drain... for your advices.. :)
I'll surely try your methods.. the thing is I want the demuxing to be happen in real time and then transcode.

well i got the VLC solution to a working model.. so that's why I'm still trying to get it sorted with VLC.. anyway it's nice to have an alternative..

cheers..

Re: demux MPEG2 TS and transcode

Posted: 19 Mar 2010 06:53
by weeraman
well i was able to get this done..
The problem i had was with the program numbering.. select="program=1" the programs are numbered as 1,2,3 etc.. in PMT (lucky that VLC provides a good verbose log.. :) )
so if anyone having the same issue.. there is a way out..

thanks for your advices. .

Re: demux MPEG2 TS and transcode

Posted: 19 Mar 2010 06:56
by weeraman
To add something more..
I'm planning to use VLC to deumux a transport stream consisting 14/15 programs.. (it'll be 40 Mbps TS stream)
but the testing i've done involved a stream with 3 programs and VLC did consume lot of CPU..

if anyone having an idea or have some experience on how to optimize the CPU usage please let me know..

Thanks.