JPHiP Radio (26/200 @ 128 kbs)     Now playing: Ravex - Bangalicious feat. Anna Tsuchiya

Author Topic: TS files (playback, re-encoding etc.)  (Read 10168 times)

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« on: October 08, 2006, 06:20:41 AM »
This thread is all about .ts
The fact is, there is never one easy solution for everyone, because everyone has different hardware in there computers and random dshow filters and codecs which affect things differently.
Also because .ts files themselves are different. Interlaced and progressive have to be handled differently by the decoder but some decoders don't handle them correctly. Some trying to deinterlace when it's meant to be progressive. Some, (mainly software ones like vlc) have trouble doing any deinterlacing at all. (they might do it but you feel the pain of 100% cpu load)
 
This thread is for anyone and everyone to contribute to, post your problems and possible solutions, guides etc.
 
To start with if you're confused about exactly what a .ts file is you could probably start with Wiki http://en.wikipedia.org/wiki/Transport_stream
 
I'm also guessing the main type of .ts files everyone will be trying to play or re-encode will be ISDB, the Japanese broadcast standard.
Read about the basic key points here: http://forum.doom9.org/showthread.php?s=&threadid=76063
 
Ok so now that's out of the road, I'll start with a guide for getting a Japanese ts to encode to Xvid (or whatever) in Gordian Knot.
 
The first problem with TS files is they can sometimes be full of errors and corruption.
The second problem is that Japanese TS files use aac audio streams which is probably not much of a problem for playback, but when you want to re-encode them it is. That's because everyone else in the world (using DVB and ATSC) has it easy and there's plenty of free programs around to just load the ts, it detects the PID's and it demuxes perfectly.
 
Japanese TS files, I've found are a bit more difficult and the only way I've managed to demux or remux the files is with Xmuxer http://www.elecard.com/products/products-pc/consumer/xmuxer-pro/
Which isn't free although there's a 21 day trial but it only lets you work with files under 10minutes play length. Of course there, is serial numbers for it around if you just look. >.>
There is ONE other program I found that is MEANT to work but I couldn't get it to. TSDemux http://www.ogg.cn/software/view-software-181.html
It got the video stream ok but it wouldn't do the audio. But I think it just depends on the ts your trying to demux, I think the one I was trying ((HDTV 1080i)Goto Maki - Glass no Pumps(Music Fighter 2006.06.02).ts) maybe had some corruption and TSDemux couldn't find the PID for the audio stream I don't know.
Anyway if anyone else knows of any programs for demuxing or remuxing Japanese TS files, post them cause I've been looking everywhere.
 
Ok so if you got the Elecard Xmuxer trial then you can to try my guide cause that's what I'm going to be using.
I think I'll start a new post for the guide on using Xmuxer and GK.

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #1 on: October 08, 2006, 06:24:30 AM »
I'll just quickly explain the whole process you need to go through in order to even start encoding a Japanese TS file to Xvid.
With your normal ATSC or DVB .ts files your actually able to load them directly into DGIndex (click the "Prepare the VOBs" button on the first tab in GordianKnot).
And DGIndex will handle it just like any other mpeg2 stream.
Unfortunately only SOME ISDB .ts files I've been able to successfully open straight into DGIndex. Most of them I've had to use Xmuxer to remux them before they will properly open in DGIndex.
The particular TS I'm using in my guide is (HDTV 1080i)Goto Maki - Glass no Pumps(Music Fighter 2006.06.02).ts. Some of you might have it :D
If you try opening it with DGIndex you'll find it's just all green and strange looking. That's why before you can open it in DGIndex you kinda have to "repair" it using the remux option in Elecard Xmuxer.
 
Here is the guide:
Open Xmuxer
You'll see 4 tabs across the top, the first one being remux.
Remuxing basically takes the ts, demuxes (splits the streams into seperate audio and video) and then reconstructs it again saving as an mpg. This mpg will then load into DGIndex ok.
 
Press Load and find the .ts file you want. It will then appear like so:

Notice that Audio isn't ticked, this seems to be just something the program does for ts files with aac audio. It must be expecting normal mpeg2 audio but anyway.
 
Make sure you retick the Audio box or else you won't have any audio in your file. Once you've done that, click the top double arrow button:

 
That will add the streams to the list that will be in the output file. You see with TS files they can actually have multiple video and audio streams in the one file and using Xmuxer you can actually choose the ones you want and extract them from it.
 
Now choose Output and find a place for where you want to save your mpg file, give it a name and then click save.
Then click start to begin the remux.
 
Once you have your mpg file you can actually go ahead and follow the rest of my Gordian Knot guide here: http://forum.jphip.com/showthread.php?t=2771
and use the mpg like it was a vob.
The key thing to remember though is it will most likely be high resolution video (not your average 720x480). It might be something like 1440x1088, when you first open it with GK you'll notice this put under where it says input resolution in the Resolution Tab in GK.
This is perfectly normal and it's because the pixel's are anamorphic. In other words they actually appear as rectangular rather than square during playback, thereby making the output resolution on your screen 1920x1080 and you don't notice a thing.
 
BUT, Gordian Knot is not very smart and it wasn't really made to deal with this resolution so you need to kinda do a bit of manual editing in the script to make it right and it's not all that difficult.
Just resize and crop it however you think it should be in GK and once you get to this step, click edit.

You'll see a bunch of crap, some of you may know that this is just an avisynth script and infact that's all Gordian Knot does, it makes an avs and sets up Virtualdub to encode it.
Anyway the key bits you need to look at are the Cropping and the Resizing so scroll down till you see those two headings.
Under cropping it might already have some numbers but if your resolution of the original video was 1440x1088 then there's a basic cropping solution to get rid of the black lines around the edges.
 
So just make it look like this:
# CROPPING
crop(2,0,1434,1080)
 
If the res of the video was a full 1920x1088
# CROPPING
crop(2,0,1914,1080)
 
If anything is wrong at this step you'll get the error saying Crop: you cannot use crop to enlarge or 'shift' a clip.
 
Now under Resizing it's up to you but I use LanczosResize cause it gives the cleanest edges and if you want it to be high res but smallish file and still playable without too much CPU usage, go for 1024x576.
So mine looks like this:
# RESIZING
LanczosResize(1024,576)
 
The next res down which I've seen around is 960x540
If you want a DVD equivilent res then something like 720x416
You could try 1280x720 as well but expect it to only work on really good cpu's, I definately don't recommend retaining a full 1920x1080 video res because for xvid that's near impossible to decode in realtime on most cpu's (although I should try that some time on my Core 2 lol) *edit* Actually I did try this and it doesnt do too bad, only uses 33% cpu usage :D but on my Athlon 2500+ it just crawls so yeah I wouldn't bother haha.
Once you have the res you want just click save and encode.
 
Ok the next thing I better point out is the aac audio track, actually this is probably the most important thing I should be covering.
When you do the first step, loading the mpg into DGindex and saving the project, that will create an aac file. Gordian Knot was never made for working with aac audio so you need to take the aac file and manually convert it to mp3 or some other format so that GK can use the file.
So it's up to you how you do this but if you want you can use the Winamp diskwriter plugin. (as dodgy as that might sound, it works)
Just open the aac in winamp, go into preferences and in output choose nullsoft diskwriter plugin. By default it will output the file directly to c:\ you can change it if you want.
Now make sure you haven't got the playlist on repeat, then click play and it will quickly convert the aac into a wav file and save that to c:\
Make sure you change the output back to your normal directsound or wave output again in preferences or it will do that for all your music you play in winamp lol.
Once you have your wave file, make sure it is exactly the same name as the aac was. Not including .aac though just leave it as .wav
The reason it has to be the same name is that there's settings in the name that GK needs to determine if the audio track has to be delayed or not. So my audio file is: pumps AAC PID 014 DELAY 467ms.wav
Select the file you made and choose your bitrate, make sure it was the same bitrate you wanted it to be under the Bitrate tab in GK. I'm just using 128k constant bitrate, I've honestly never heard anything wrong with 128k mp3 so I use it a lot.
 
The rest of the steps follow on with the guide.
hmm I hope I haven't confused anyone lol I should probably redo the guide in full, for someone who wants to encode .ts

Offline SacredCultivator

  • AYO T-ara~
  • ecchi
  • Member+
  • Posts: 1737
TS files (playback, re-encoding etc.)
« Reply #2 on: October 08, 2006, 06:32:30 AM »
Well I have been having a problem with .TS Files and have yet to find an answer to it (Tried 4-6 other forums) BUT..

I can get smooth playback with no problems if I plan to only watch it via Monitor. But if I want to watch on my TV that is where my problem is..

But anyway... Semi-Quoted from other forums:
The things that I use are:
Media Player Classic
K-Lite Mega Codec Pack
Nvidia PureVideo

So anyway, the Nvidia PureVideo is the 'demuxer' I use, haha not even sure if that is right had someone online help me with that setting in Media Player Classic.

BUt for smooth playback with what I use I simply choose 'Overlay Mixer' as the DirectShow Video, and presto... If I have it set to those VMR settings it has choppy playback.

And my problem is when I want to watch it via TV, I can use the same settings but through my Video Card (GeForce 6600gt) settings and forcing Full Screen Video (On Secondary Device{TV}) there are sidebars(Widescreen) for the .TS files which of course is an annoyance. (But my problem isn't really with .TS Files primarily but something else so I can't troubleshoot on this thread, and still waiting for a reply on the other which people haven't really been replying =X).

  So that is my input on .TS Files.


Re-Encoding Wise... Heh I don't even bother as I can't seem to do it with SUPER(c), and Gordian dunno, just don't really have the time to learn it =X.
Hello!Fansub's is recruiting Translators / Karaoke Typesetters, if interested PM me.

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #3 on: October 08, 2006, 06:57:47 AM »
^^ Purevideo is pretty good if you can get it working properly. With the right hardware (I think GF 7 series up) the adaptive deinterlacing is meant to be the best. It's also meant to support h264 decoding but I've never really seen it in action just screenshots of people playing h264 with 0 cpu usage.
 
Anyway, it's not really the demuxer it's just the decoder being used by the player. It handles TS files ok although I've had problems where it tried deinterlacing the video when it was really progressive.
 
What I wish Nvidia would do is actually release their own fully stand alone player which utilizes all the filters included with Pure Video.
Cause at the moment it's relying on Mediaplayer which will try to use any codec or filter that's been installed and that leads to conflicts and all kinds of crap that most nonhardcoregeek people want to deal with so they just go back to using VLC and putting up with high CPU usage.

Offline Masabi

  • ミ★
  • ecchi
  • Member+
  • Posts: 2080
  • metallica orz
TS files (playback, re-encoding etc.)
« Reply #4 on: October 08, 2006, 07:22:40 AM »
Yeah, TS never works for me either, I don't know why.. but thank you for posting this.. There are so many HDTV perfs that I would want just in regular AVI high quality but I never knew how to convert.
The artist formerly known as Gray.

Offline SacredCultivator

  • AYO T-ara~
  • ecchi
  • Member+
  • Posts: 1737
TS files (playback, re-encoding etc.)
« Reply #5 on: October 08, 2006, 08:09:10 AM »
Hehe yeah... I mean PureVideo actually comes with a player BUT I can't seem to get ANYTHING to load onto it... And I am too lazy to buy a new Video Card to really test the PureVideo Feature as I have the StandAlone one where you have to pay ><... And I am not a very good 'tech' when ti comes to hardware so then I really am a little bleh when all files play 'right' except for the .TS which I am starting to download more and more of...

And I have like 2 people working on different ways to possibly fix my problem but then they are busy so can't really expect much from them for the time being...

@Agrayrainbow: What is your problem with .TS files? Your player just not recognizing them? If that is so, it is due to Codecs which there are a plethora that you can choose from, well known ones => K-Lite Mega Codecs + CCCP
Hello!Fansub's is recruiting Translators / Karaoke Typesetters, if interested PM me.

Offline frblckstr1

  • The Archive
  • ecchi
  • Member+
  • Posts: 5359
TS files (playback, re-encoding etc.)
« Reply #6 on: October 08, 2006, 08:56:34 AM »
I have one 'last resort' re-encoding method (although is gives DVD level quality only):
When it plays on my laptop (including sound) I can connect it to my harddisk recorder via (s-)video out and stereo sound, I record that and burn it to re-writable's to copy it over to the computer again.

For some reason playback works still for most of files the converters do not want to 'read'.

I am still considering buying a high performance PC to put into my HiFi setup, but replacing a 250 euro piece of equipment (Pinnacle SowCenter 200) that plays about 99% of the files with a 1200 euro PC... I have other toys to buy first :)

Offline ohbahsan

  • Member+
  • Posts: 283
TS files (playback, re-encoding etc.)
« Reply #7 on: October 08, 2006, 10:05:22 AM »
whoa, that looks complicated.  How about mencoder?  Two lines in a batch file, can't get simpler than that (unless you do 1-pass encoding).

mencoder.exe gnp.ts -oac mp3lame -lameopts preset=128 -vf scale=960:540 -ovc xvid -xvidencopts pass=1 -o NUL
mencoder.exe gnp.ts -oac mp3lame -lameopts preset=128 -vf scale=960:540 -ovc xvid -xvidencopts pass=2:bitrate=2000 -o gnp.avi

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #8 on: October 08, 2006, 10:21:01 AM »
How well does mencoder handle Japanese ts files?
Hmm I should try it on that pumps ts. actually.
 
*edit*
Ok I tried mencoder it seems to do the right thing by encoding but it didn't handle the audio properly. (although it'd probably be fine with most .ts files)
The TS I'm trying to convert seems to have an error at the very beginning which causes the audio to delay by 467ms. Is there any option in mencoder that makes it detect audio problems and compensate it by delaying it so it lines up again?
 
Also at 960x540 with bitrate of 2000, it's pretty grainy lol so yeah might wanna use 6 or 7000 for the bitrate but otherwise that script seems simple enough and I'll prebably try learn how to use mencoder more I think.
Thanks for the script ohbahsan :)

Offline Masabi

  • ミ★
  • ecchi
  • Member+
  • Posts: 2080
  • metallica orz
TS files (playback, re-encoding etc.)
« Reply #9 on: October 08, 2006, 10:51:19 AM »
Quote from: SacredCultivator
@Agrayrainbow: What is your problem with .TS files? Your player just not recognizing them? If that is so, it is due to Codecs which there are a plethora that you can choose from, well known ones => K-Lite Mega Codecs + CCCP



Nah, they just have huge "scanlines" in the middle when I try to play it, not to mention my monitor is 1024x768 and many .TS files are way bigger than that.  It plays, but it's laggy.
The artist formerly known as Gray.

Offline Janihan

  • Member+
  • Posts: 81
TS files (playback, re-encoding etc.)
« Reply #10 on: October 08, 2006, 10:56:45 AM »
I'd recommend MEncoder too. Never had a problem with it.

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #11 on: October 08, 2006, 11:02:56 AM »
Quote from: agrayrainbow
Nah, they just have huge "scanlines" in the middle when I try to play it.
Sounds like it's not deinterlacing. So depending on the player and the decoder being used you need to tell it to deinterlace. Usually if it's a good one that uses hardware support or DXVA then you should notice that the playback is very very smooth when the correct deinterlacing method is turned on.

Offline Masabi

  • ミ★
  • ecchi
  • Member+
  • Posts: 2080
  • metallica orz
TS files (playback, re-encoding etc.)
« Reply #12 on: October 08, 2006, 11:04:28 AM »
Quote from: ebc
Sounds like it's not deinterlacing. So depending on the player and the decoder being used you need to tell it to deinterlace. Usually if it's a good one that uses hardware support or DXVA then you should notice that the playback is very very smooth when the correct deinterlacing method is turned on.

I don't even know how to do that haha.  I'm using VLC..

[edit] I started using "Mean" deinterlacing and it got rid of the "scanlines" but it still doesn't play as smoothly as I'd like.
« Last Edit: October 08, 2006, 11:15:27 AM by Gray »
The artist formerly known as Gray.

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #13 on: October 08, 2006, 11:13:51 AM »
^ while the video is playing click Video> Deinterlace and then you can choose a number of options just try each one to see which one looks best.
For me VLC just chugs the framerate and doesn't even come near to playing as smoothly as PowerDVD or with MPC with PowerDVD decoder.

Offline frblckstr1

  • The Archive
  • ecchi
  • Member+
  • Posts: 5359
TS files (playback, re-encoding etc.)
« Reply #14 on: October 08, 2006, 12:42:12 PM »
Quote from: ebc
The TS I'm trying to convert seems to have an error at the very beginning which causes the audio to delay by 467ms. Is there any option in mencoder that makes it detect audio problems and compensate it by delaying it so it lines up again?
Have you tried MPEG2repair? seems to be one of the prefered tools in the adhdtv forums...

Offline ebc

  • Administrator
  • Member+
  • *
  • Posts: 6017
  • >:|
TS files (playback, re-encoding etc.)
« Reply #15 on: October 08, 2006, 12:54:06 PM »
^yep it says:
Can't find sync byte in rest of input file. Remaining data discarded

Offline Guchi_Jnr

  • Livin' Your Dream
  • ecchi
  • Member+
  • Posts: 2810
TS files (playback, re-encoding etc.)
« Reply #16 on: October 08, 2006, 01:58:04 PM »
Thought I'd have a play too. :)

Went with MediaCoder, since it can handle most vids I've thrown at it, and this .ts was (almost) no exception.
Just ticked deinterlace ,dropped the resolution down to 640x360, XviD@2500 and audio @192CBR.

Got to around 99% through the second pass, then spat out an error which didn't really do anything. The header was corrupt, but ran the encoded avi though VirtualDubMod, and it was good to go.


http://d.turboupload.com/d/1060236/Goto_Maki_-_SOME_BOYS_TOUCH_640x360.avi.html

Offline Janihan

  • Member+
  • Posts: 81
TS files (playback, re-encoding etc.)
« Reply #17 on: October 08, 2006, 02:42:43 PM »
Quote from: Guchi_Jnr
Got to around 99% through the second pass, then spat out an error which didn't really do anything. The header was corrupt, but ran the encoded avi though VirtualDubMod, and it was good to go.

I guess the video wasn't competely fixed since atleast MPlayer couldn't seek in it unless I used -forceidx (Force  index  rebuilding).

Thanks for the file anyway. I'm gonna try comparing the output quality of MEncoder with your video.

EDIT:
It looks like MediaCoder uses MEncoder... :P
Atleast I can compare a lavc version with your xvid version.
« Last Edit: October 08, 2006, 02:48:48 PM by Janihan »

Offline ohbahsan

  • Member+
  • Posts: 283
TS files (playback, re-encoding etc.)
« Reply #18 on: October 09, 2006, 12:37:51 AM »
Quote from: ebc
The TS I'm trying to convert seems to have an error at the very beginning which causes the audio to delay by 467ms. Is there any option in mencoder that makes it detect audio problems and compensate it by delaying it so it lines up again?
I dunno if you ever looked at the man page for mencoder but it's like a billion pages long :lol:, I'm still trying to figure out some of the most basic things.  

I find with some .ts files they are not "cut" properly so there would be an error in the beginning or at the end.  You can skip the start by using the -ss or the -sb parameter, and you can skip the end by using the -endpos parameter.

Offline Jsmurf

  • BUKKAKE!!!
  • ecchi
  • Member+
  • Posts: 344
TS files (playback, re-encoding etc.)
« Reply #19 on: October 13, 2006, 10:06:59 PM »
Quote from: ebc
There is ONE other program I found that is MEANT to work but I couldn't get it to. TSDemux


thats weird, i've been using tsdemux for awhile now. hasnt let me down yet

also been authoring these on to dvds, pretty neat watching these high quality performances on the tele
:shakeit:

JPHiP Radio (26/200 @ 128 kbs)     Now playing: Ravex - Bangalicious feat. Anna Tsuchiya