Log in

View Full Version : Converting h.264 ts to mpeg-2 (HDTV)


rombrero
12th December 2006, 12:25
I have serveral h.264 ts files from BBC-HD on my hardisk.

I am not able to play those files with my kiss dp-600 media player because it has no support to play h.264 files.

Now i am looking for a way to convert those h.264 ts files
(1440x1080/25fps, Audio [AC3 5.1] 384kbps) to 1920x1080
mpeg-2 ts files

What software do i need to do this, and will i loose a lot of quality during the conversion.

idbirch2
12th December 2006, 14:37
<Gasp!> The B word!

I have been doing exactly what you are wanting to do and if you check the abhdtv.net forums in the reposts scetion you will see I have discussed my hard work there for all to enjoy.

The process mainly requires Canopus Procoder 2 and PowerDVD 7.0 to be installed. I did try CoreAVC but about 40mins into episode 1, it throws a "CoreAVC does not support BTU (can't remember the exact letters) frames" error and the last 20 mins was just a black screen with that error in white writing. Cyberlink's H264 decoder had no such trouble.

I set the res to 1440x1080 (same as original), MPEG2 Elementary Stream, 20Mbps (25Mbps peak) and the result was great, I can't see the difference when watching through my 360 extender.

rombrero
12th December 2006, 15:20
Thanks for the help. I have installed Procoder 2 . I already had
installed power dvd 7. Unfortunately i am not able to load the
source video file (h.264 file)

I get an error message: an interface has too many methods to fire events from

idbirch2
12th December 2006, 16:33
Ooo, that's a nice one!

Firstly, rename your file to a .ts extension, I had trouble myself when using the .264 or .H264 extensions. Also, install GraphEdit and open the TS in that to check your graph.

Make sure that the Cyberlink H264 decoder is being used. Get rid of any Elecard (ugh!) or ffdshow (ugh!) programs and make sure AC3Filter is handling the audio. I found this combo a winner. If you do have any filters being used that you don't want, download the genius "FiltersManager" program which will show you all DirectShow filters installed on your machine and allow you to register/unregister them quickly and easily.

If all this is done Procoder should be quite happy opening the ts file.

edit: I would also remove the "Best way to" from your thread title before the mods hit you for a rule 12 violation.

rombrero
12th December 2006, 18:04
The files that i am trying to play already have the ts extension, however not always direct noticable because i have also installed videolan.

I have uninstalled progdvb (which is using elecard filters) and
i have looked at the files in graphedit .One h-264 file has normal audio and this file is using: MPEG Audio Decoder and the other h.264 file has AC3/DD5.1 audio and this file is using:
Cyberlink Audio Decoder (this last file won't play in Power DVD
7 but only in the player of TScoverter 2.5 of dvbportal) Both files are using:Cyberlink h.264/AVC Decoder for the video

I have unregistred the MPEG Audio Decoder and the Cyberlink Audio Decoder in order to give the AC3 filter a change to take over. After that i did this i still have the error message in procoder and the h.264 file with the normal audio did not play
well in PowerDVD 7 (video ok, no sound) so i registred the audio filters again to solve that problem.

Do you think that videolan is causing problems ? I have the latest version.

idbirch2
12th December 2006, 18:37
Hmm, VideoLAN shouldn't cause any problems as its filters are all internal and don't tend to muslce in outside of VideoLAN itself, I have it installed myself.

I'm sorry to say though that I also had to ditch all the DVBPortal stuff (HDTV Pump, dump and TS Converter) to get things working properly.

Try installing the Haali Media Spiltter and let me know if that helps. Although it doesn't appear in my Graphedit graph, the tray icon for it pops up when building the graph so it must be doing something.

It is strange that the file won't play in PowerDVD 7 so something is still interfering. Which episode of Planet Earth do you have - the original posts of the first few episodes were full of errors (took me weeks to find this out though, all the time thinking I was doing something wrong.)

The Pole To Pole episode I have is 8.40GB (9,023,767,444 bytes) - do you have the same file? Oh, and check your version of ProCoder, I have 2.04.02.00.

rombrero
12th December 2006, 20:39
The problem was the version of procoder 2 (i had 2.01)
I am now also using version 2.04.02.00. And everything is going perfectly.

I had some doubts if i had to choose 1440x1080 or 1440x1088
(same as the original file) I have chosen the last one with a VBR (two pass 24000-25000). 1920x1080 is probably not a good idea.

Do you know how i can mux the m2a and m2v file.

The files that i was using were: Corinne Bailey Rae, in concert at LSO St Luke's in Shoreditch (the file that won't play in power dvd) and Beyonce at the BBC.

I should get Planet Earth also, i did hear some good things about that series

idbirch2
12th December 2006, 21:02
Ah yes, now that I read your original post again I see you didn't mention Planet Earth, I assumed it was that, got it on the brain I guess.

The best size to pick would be 1440x1080 but crop the bottom 8 pixels. These 8 pixels are just a blurry line at the bottom of the picture. VLC cuts these off automatically but if you play the files in a different player, you should see the line I'm talking about.

To remove it, add you BBC-HD as a source and then go to [Advanced] (still in the souce tab).

Click [Video Filter] and then [Add]. Choose [Crop] press [OK]. Underneath the 2 preview windows (these may just say "Can't render" - that's OK), scroll down to [Vertical Cropping] and reduce the 1088 value to 1080. This will remove the horrible blurry 8 pixels from your output. Press [Close] and then setup up your target.

I'm sure the BBC-HD streams are interlaced yet strangley enough, during extensive tests, I found choosing "Non-Interlaced" on the target resulted in a better looking, smoother scrolling output. Have fun!

Oh, one last thing. I found that when opening the Planet Earth streams in Procoder, they were detected as 29.97fps which is obviously incorrect as this is PAL material. To correct this, install Haali Media Splitter and open it's config window. Go to [Options] then [Output] and set the "Force fake 25fps in media type" to "Yes". Press [OK] and you should find Procoder correctly detects it as 25fps (PAL) now.

rombrero
13th December 2006, 11:34
Thanks a lot for that excellent tip about the Haali Media Splitter !!

The conversion finished through the night and i played it with the kiss dp-600 on my plasma display, but the picture was too
small. If i switched the plasma to 4:3 the aspect ratio was was far less than 4:3 (more like 2,5:3) The only way i could correct that was to use the setting : wide. Ofcourse i don't want to use that setting because the picture is progressively strectched and corrine bailey rae looked much to thin (because she was sitting in the middle of the picture)
I have also converted in 1920x1080 in the hope that this setting will correct that. But the result was exactly the same


I did choose as setting a transport stream (the result a m2t file, which i converted with projectx to a ts stream)
I suppose i could also have choosen elementary stream but i was not sure if TPMGEnc Xpress could mux those files
For the audio i did choose 384,(same as specs of original file: Audio; AC3 5.1 ~384Kbit/s) instead of the standard lower value. Can not choose AC3 5.1 audio so i presume i loose that in the conversion unless there is a workaround.

Do you ticket: Put Sequence Header On Each GOP ? I choose not to do this

Although the result is not 100% yet i was very pleased with the quality of the footage after the conversion

idbirch2
13th December 2006, 21:02
I'm not sure what's happening with your aspect ratios there, what is the AR set to on your source and target? For my Planet Earth episodes, both are on 16:9.

I set my target in ProCoder to an elementary stream and TMPGEnc accepts it when remuxing the original audio back in. If you want to keep your 5.1 AC3, demux it from the original file and tell Procoder not to process the audio at all (choose "None" on the source tab and "Don't Use" on the target tab).

No, I don't tick the "Put sequence header on each GOP" optin either.

rombrero
14th December 2006, 13:35
The aspect ratio problem is solved. On the source file in procoder square pixels was selected.

I am absolutely stunned with the end result. It's almost as good as a high quality mpeg-2 hd broadcast from the US (like for instance the grammy awards)

In order to save 5.1 AC3 stream i have been trying to demux the stream but this is not possible in TPMEGenc. Appearently it doesn't accept h.264 streams. I have read on the forum that this is possible with mplayer, but i think i have reached a point that i am trying to do things that are to diffecult to do, for me anyway. I have know idea how to compile a program when there is no exe file.

I was able to demux the file with projectx but after muxing the audio back with the converted video file, the audio is completely out of sync.

idbirch2
14th December 2006, 14:31
Glad to hear you're nearly there, don't give up yet. ProjectX is probably fine to demux the audio, personally I use mplayer which isn't as difficult to use as it sounds. You can find a fully compiled version here (http://esby.free.fr/CelticDruid/mirror/mplayer/). Just download the 3rd of December version and make sure its the one which suits your CPU.

Once you have Mecoder installed, open up a command prompt and get youself into the Mecoder directory. To demux audio the syntax is:

mplayer -dumpaudio -dumpfile "X:\destination.ac3" "X:\Source H264 stream"

So if I have a planet earth episode called "PE101.ts" stored on my H:\ drive and I want the AC3 audio, I would use:

mplayer -dumpaudio -dumpfile "F:\DumpedAudio.ac3" "H:\PE101.ts"

Having said all that, I think ProjectX is probably doing fine, I also end up with audio being out of sync after muxing with TMPGEnc. Best way to fix this is to open it up in VideoReDo and click Tools -> Adjust Audio. I am finding that everytime, I need to adjust by +800ms. Resave the file in VideoReDo and you should be done.

rombrero
14th December 2006, 19:04
Yes i am nearly there, because of all your help. Thanks a lot !

I have tried to use mplayer, but i think that i did something wrong because i see nothing happening when i click both the exe files from mencoder and mplayer. I have a pentium D processor and i did choose p4 from the fully compiled list link.
Afterwards i looked if there were any directories created but could not find one. I also forgot which command i have to use in DOS to go to a certain directory.

Do you think that it is normal that a BBC HD broadcast has these audio values: MPEG-1, Layer2, 48000Hz, stereo, 256kbps. Having some troubles with the audio and i thought that these values are a little bit low. What are the audio values of your Planet Earth files.

Very pleased with the fact that there is a solution for the audio sync problem. I thought of correcting this in premiere pro but i can't import ac3 files in that program
I have read a little bit about : "repeat sel" in the help files of
VideoReDo but i don't think that i have to ticket that.

idbirch2
14th December 2006, 20:55
The mplayer/mencoder exes won't do anything if you double-click them as they only work from a command line. Once you're at a command prompt, make sure you are on the drive mplayer is on (hopefully C:\) and type cd\ then Enter. This should give you a C:\> prompt. Now just use the "cd" command to get down to the mplayer directory e.g:

cd "program files" -> Enter
cd "mplayer" -> Enter
mplayer -dumpaudio -dumpfile "F:\DumpedAudio.ac3" "H:\PE101.ts"

Not sure if its normal to just have stereo audio on a BBC-HD file but its certainly possible. Where are you getting those values from?

I'm not sure what you mean with the "repeat sel" comment about VideoRedo....

rombrero
14th December 2006, 21:58
I can find the program files directory (C:\program files>), but not the mplayer directory because after that i get the message: the system can not find the path specified.May be it is installed somewhere else , but have no idea where to look. I found out that TSconverter can also demux a h.264 stream but only if it is a AC3 file and not if it is a mp2 file.

The audio values where from a projectx log after demuxing, and the boyonce file was downloaded from a.b.hdtv

After muxing the complete file in VideoReDo i am seeing severe macroblocking (not all the time, but at times so severe that 60 procent of the picture disappears) Also i get the message and the end off the muxing of the audio stream: PTS underflows 7683 (in red). I am sure that VideoReDo is causing this because the out of sync mpg file does not have this problem. May be this is a settings issue.

This is from the VideoReDo helpfile, but i don't understand
what is they mean;"The Repeat Sel" checkbox is used to automatically repeat the current selection until the dialog box is closed. You will find this useful when a section of video is located where audio / video synchronization is obvious such as a close-up of people speaking or the occurrence of a sharp sound effect". So if i go to: tools -adjust audio synchronization
i see that checkbox on left end from the slider.
May you have a version where you can not check that. My version is:2.2.1.445.

rombrero
16th December 2006, 10:58
There is something that i forgot to ask: do you know if BBC HD
is upper field first I have read somewhere that all HD flavours
(HDV, HD) are upper field first.

I have looked for a stream h.264 analyzer but i could not find one.

The scaler in the kiss DP-600 is not very good and i wonderded if i would get better results with encoding to 1920x1080. If i encode it to 1440x1080 the "bad" scaler in the kiss will scale it to: 1920x1080 and the scaler in the plasma will scale it to: 1280x768

idbirch2
16th December 2006, 11:54
Regarding mplayer, yes, it must be installed in a different location. I've no idea what that would be. If Project X is giving you a valid AC3 file, stick with that for your audio demuxing.

With VideoRedo, you are using a very, very old version which is notorious for problems due the the really badly made crack which I think you might be using.

Completely uninstall your old version, delete the program directory and then download the latest beta from here (http://www.videoredo.net/beta/VideoReDoPlus-2-5-3-501.exe) and request a trial key. This will work for 2 weeks and is fully functional. Make sure you close and re-open VRD after entering your trial key!!

I'm confident all that horrible blocking will mysteriously disappear when you use the latest, legit version.

rombrero
16th December 2006, 14:59
You were absolutely right, i needed this latest version of VideReDo. No problems anymore with macroblocking.

ProjectX for demuxing for demuxing h.264 ts streams seems to be a good choice, because also the audio is now perfect.

Did test a little bit with 1920x1080 and 1440x1080 , but i could not see any picture difference between the two.
Strangely enough there was also no difference in upper of lower field first. I did use a CBR of 30 mbps and picture structure automatic.
Wanna try what you did also (source: interlaced and target non-interlaced)
Using mastering quality over high quality did make a difference, and only did make the conversion process about 1 hour longer (video +/- 30min)

idbirch2
16th December 2006, 16:00
Cool, sounds like you've just about cracked it. It's always preferable, where possible to re-encode at exactly the same resolution as your imput, that way the encoder doesn't have to apply any scaling. For that reason, I highly recommend you stick with 1440x1080 instead of 1920.

Setting source to interlaced wasn't actually a conscious decision, ProCoder just set that automatically when I opened the source file so assumed it auto-detected it or something.

I'm surprised to hear mastering quality made a difference, I had read elsewhere that it doesn't and not to bother using it but now I think I'll give it a try.

rombrero
16th December 2006, 19:57
Couldn't be happier with the progress that i made last week.
I would never ever have found out how to do this without your help.
Downloading from the hd newsgroups has suddenly become far more interesting and fun, because i am no longer limited
to mpeg-2 files.

I will follow your advice and use only 1440x1080, which has also as advantage that encoding is much faster.

idbirch2
16th December 2006, 22:26
Great! I'm happy that you're happy. That's what this place is for though, sharing the knowledge.

It's true, there's so much stuff being posted in H264 now, its a bit annoying. But as long as we can continue to convert to a sensible format that actually works on network media players, we're OK.