Help converting ts files from Humax PVR

1356

Comments

  • jzeejzee Posts: 25,498
    Forum Member
    ✭✭✭
    son_t wrote: »
    This seems so... as I have not downloaded that utility and processed the Lost Land of the Jaguar recording... and now I have sound after installing the codec pack (whereas before I got pops and cracks)...

    Update: it looks like Enc HD recordings on the HDR are encrypted (or simply obfuscated) after all - as I can only play a few seconds of such recordings before they just stops playing...
    Did you make that recording recently as BBC apparently only re-added the AC3 'feature' in late November? I take it was also a recording made in freesat mode not using the non freesat workaround?
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    Lost Land of the Jaguar was recorded in non-freesat mode (no Enc flag) on 31/12/2008.

    The others, that froze or stopped playing after a few seconds, are a lot older and were recorded in freesat mode (with the Enc flag) and transferred directly off the internal HDD. I will make some more tests by transferring more recent Enc HD recordings off the HDR to see if they play or not.
  • jzeejzee Posts: 25,498
    Forum Member
    ✭✭✭
    son_t wrote: »
    Lost Land of the Jaguar was recorded in non-freesat mode (no Enc flag) on 31/12/2008.

    The others, that froze or stopped playing after a few seconds, are a lot older and were recorded in freesat mode (with the Enc flag) and transferred directly off the internal HDD. I will make some more tests by transferring more recent Enc HD recordings off the HDR to see if they play or not.
    I'm sure someone stated they had managed to copy BBC HD files on play them back on their PS3? Maybe you could try running that DVBViewer tool and see what happens?
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    I'll give the DVBView tool a go, but I thought that just fixes the audio..?

    EDIT: Just registered and downloaded 'BBC HD Fixer', and it is no good... All my BBC HD recordings gives the error 'Lost sync while reading the TS packets'. I think this tool is just for DVBViewer BBC HD captures... :(
  • jzeejzee Posts: 25,498
    Forum Member
    ✭✭✭
    son_t wrote: »
    I'll give the DVBView tool a go, but I thought that just fixes the audio..?

    EDIT: Just registered and downloaded 'BBC HD Fixer', and it is no good... All my BBC HD recordings gives the error 'Lost sync while reading the TS packets'. I think this tool is just for DVBViewer BBC HD captures... :(
    Looks like it son_t- sorry about that. :( Is this the first time you have tried to play recordings off the Humax on a PC? Someone definitely stated they managed to play a BBC HD file from the Humax on a PS3 but I can't recall who it was unfortunately.
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    No problems, thanks for your efforts! This is the first time I've managed to play HDR's BBC HD recordings (but only the non enc). The enc recordings have behaved like this (plays just a few seconds before stopping) since the beginning...

    I am making progress at least. Maybe the PS3 managed to play only non Enc recordings, like I have today..?
  • [Deleted User][Deleted User] Posts: 311
    Forum Member
    jzee wrote: »
    Looks like it son_t- sorry about that. :( Is this the first time you have tried to play recordings off the Humax on a PC? Someone definitely stated they managed to play a BBC HD file from the Humax on a PS3 but I can't recall who it was unfortunately.
    I posted a while back that the PS3 will play the non encrypted Humax HD streams in the original TS container. However, as the file normally includes an AC3 and MP2 audio stream the PS3 only seems to play the MP2 stream and doesn't pick up the AC3 one when cycling through the audio streams available.

    What I normally do is remux the TS stream into an MKV container using Haali Media Splitter, this should be playable on a PC using VLC player. But I'm not finished there, I then demux the MKV using MKVExtractGUI, then I use the original AVC video and convert the AC3 5.1 channel stream , if available, to AAC using MediaCoder or Super. Finally I use Yamb to mux into an MP4 file. This is the only way that I've been able to keep the audio in sync with the video for some reason. The file then plays fine with Nero showtime. As I like to keep my files as small as possible, I will reduce the 14-16GB file to around 4GB so that it will play on the PS3, I find the end result acceptable, although the whole process could be considered a little time consuming!
  • [Deleted User][Deleted User] Posts: 82
    Forum Member
    I tend to use http://handbrake.fr/ for these things and touch wood so far not an issue. It will work with ts files although not tried the Humax ones yet as I don't have one yet.
  • jzeejzee Posts: 25,498
    Forum Member
    ✭✭✭
    son_t wrote: »
    Lost Land of the Jaguar was recorded in non-freesat mode (no Enc flag) on 31/12/2008.

    The others, that froze or stopped playing after a few seconds, are a lot older and were recorded in freesat mode (with the Enc flag) and transferred directly off the internal HDD. I will make some more tests by transferring more recent Enc HD recordings off the HDR to see if they play or not.
    Sorry son_t- I think I misunderstood you - so you can get the Lost Land of the Jaguar to play OK using media player classic? Can you check what filters are in use (right click video\>filters)?
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    Media Player Classic (unicode build)
    Version: 6.4.9.1 (revision 73)

    (Right-click->Filters)

    Default DirectSound Device
    Video Mixing Render 9 (Renderless)
    Audio Switcher -> Lost Land of the Jaguar.ts / Audio
    ffdshow Video Decoder
    ffdshow Audio Decoder
    Lost Land of the Jaguar.ts -> Service 6940 (ticked) | V:PID 2328 [Undetermined] (ticked) | A:PID 2330 [Undetermined] (ticked) A: PID 2329 [English] | No subtitles (ticked)

    (Right-click->Properties)
    Video: MPEG4 Video (H264) 1440x1080 (16:9) 25.00fps [Video]
    Audio: MPEG4 Audio 48000Hz stereo [Audio]
  • jzeejzee Posts: 25,498
    Forum Member
    ✭✭✭
    son_t wrote: »
    Media Player Classic (unicode build)
    Version: 6.4.9.1 (revision 73)

    (Right-click->Filters)

    Default DirectSound Device
    Video Mixing Render 9 (Renderless)
    Audio Switcher -> Lost Land of the Jaguar.ts / Audio
    ffdshow Video Decoder
    ffdshow Audio Decoder
    Lost Land of the Jaguar.ts -> Service 6940 (ticked) | V:PID 2328 [Undetermined] (ticked) | A:PID 2330 [Undetermined] (ticked) A: PID 2329 [English] | No subtitles (ticked)

    (Right-click->Properties)
    Video: MPEG4 Video (H264) 1440x1080 (16:9) 25.00fps [Video]
    Audio: MPEG4 Audio 48000Hz stereo [Audio]
    Ah, it is using ffdshow which is what I use in DVBViewer with no problem except in ITV HD- do you have any unencrypted ITV HD recording you can test with it? The MPC HC decoder can utilise DXVA for AVC/h.264 but it will only works if your GPU supports it.
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    son_t wrote: »
    No problems, thanks for your efforts! This is the first time I've managed to play HDR's BBC HD recordings (but only the non enc). The enc recordings have behaved like this (plays just a few seconds before stopping) since the beginning...

    Why not try stripping out the humax junk with the vb routine posted above? Assuming the file structure is the same, which is a big assumption, I know. :(
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    jzee wrote: »
    Ah, it is using ffdshow which is what I use in DVBViewer with no problem except in ITV HD- do you have any unencrypted ITV HD recording you can test with it? The MPC HC decoder can utilise DXVA for AVC/h.264 but it will only works if your GPU supports it.

    We can't record ITV HD in non-freesat mode as the red interactive button does not work! Although, has anyone tried to record the ITV HD channel 10510 in non-freesat mode to see what that captures?
    mwardy wrote: »
    Why not try stripping out the humax junk with the vb routine posted above? Assuming the file structure is the same, which is a big assumption, I know. :(
    I would if I had a VB compiler ;) Could someone translate that code to C or Perl or something more accessible?
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    son_t wrote: »
    I would if I had a VB compiler ;) Could someone translate that code to C or Perl or something more accessible?

    You can just paste it into excel, as grahamlthompson said.

    New document>Alt+F11.

    I had no idea this was possible before I read this thread, and having no experience of vb can't add a dialogue box to jack plug's code, but I was able to reproduce his experiment on the uploaded file from Nick123 by editing the path.

    vb is much more powerful than the stuff I used to type into 8 bit processors it seems! :)
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    mwardy wrote: »
    can't add a dialogue box

    I have a vb primer printed off now, but if some nice person could supply the code that would be great. :D
  • grahamlthompsongrahamlthompson Posts: 18,486
    Forum Member
    ✭✭
    mwardy wrote: »
    I have a vb primer printed off now, but if some nice person could supply the code that would be great. :D

    Presume you are modifying the code already posted to make it general purpose if so

    Replace

    fni = "H:\" + "Test from Nick.ts"

    With

    fni = Application.GetOpenFilename(, , "File To Open")

    To specify a different file name and destination for the output at run time

    Replace the line

    fno= whatever file you hard coded

    with

    fno = Application.GetSaveAsFilename(, , , "File Name To Save")

    That's It
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    grahamlthompson, thank you! It works a treat.

    I've also discovered a sort of proof that the junk stripper is doing its job in that the original won't play in videoredo plus (which .ts files default to on my machine rather that videoredo TV suite) but the cleaned up file will.

    That primer didn't get as far as dialogue boxes anyway! :D
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    I can't get to work.

    I have Excel 2002. Start it up, get a new workbook. Alt+F11 to get the VB screen. Click on Sheet1 in the LHS menu. Menu-View->Code (or F7). Paste above code into editor...
    Public Sub trimTS()
    Dim junk(3) As Byte, a(187) As Byte
    Const sync_byte As Byte = &H47
    Dim fni, fno
    
    fni = "N:\" + "wag.ts"
    fno = "N:\" + "wagpro.ts"
    
    Open fni For Binary Access Read As #1
    Open fno For Binary Access Write As #2
    
    Get #1, , junk
    Get #1, , a
    While a(0) = sync_byte
        Put #2, , a
        Get #1, , junk
        Get #1, , a
    Wend
    Close
    End Sub
    

    Note the file changes (for the location of my .ts file)...

    Press > (or Menu->Run->Run Sub/UserForm or F5). Two files are produced, wag and wagpro.ts of zero size!

    Tried this again on another SD recording - same result... What's wrong?

    EDIT: I used Graham's modification above for fni and fno, and the code seem to work...

    Here are the results:

    I tried this on Wallace and Gromit (BBC HD) recording of 3.6GB and it produced a 34.2MB file! I tried it on Talk To Her (SD) recording of 2.46GB and it produced a 1.95GB file.

    The processed Wallace and Gromit video file played up to the point where it freezes (HD protection kicks in)... and Talk To Her is as choppy as the original recording played on my Vista machine on the MPC I got working yesterday...

    Conclusion:

    The VB code does BUGGER ALL! :D:D:D (I think mwardy is asking a good question below!)
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    jack plug wrote: »
    Couldn't resist having a look at Nick's sample HDR file.

    The file format is like this : JTJTJTJTJTJTJTJTJT...

    J = humax junk = 4 bytes
    T = transport stream packet = 188 bytes


    Just remove the junk to recover the original transport stream : TTTTTTTTT...

    Public Sub trimTS()
    Dim junk(3) As Byte, a(187) As Byte
    Const sync_byte As Byte = &H47
    Dim fni, fno
    
    fni = "H:\" + "Test from Nick.ts"
    fno = "H:\" + "fixedNick.ts"
    
    Open fni For Binary Access Read As #1
    Open fno For Binary Access Write As #2
    
    Get #1, , junk
    Get #1, , a
    While a(0) = sync_byte
        Put #2, , a
        Get #1, , junk
        Get #1, , a
    Wend
    Close
    End Sub
    

    Can I ask how you worked this out? It looks like 47 is a special number in .ts files. I had a look at the file and 47 seems to appear too irregularly for it to be a sync byte by itself. I can see a string counting something like 47 13 88 10...11...12 etc but it doesn't seem to be coming up at regular 188 byte intervals. :confused:

    Tia!
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    son_t wrote: »
    I can't get to work.

    Is wag.ts in the root directory of N:? Sorry if it is, but I got the same results until I realised you have to put the full path in the first part of the fni and fno statements. (God knows why I didn't think of it straight away!) Or use grahamlthompson's handy replacement statments.

    Edit: hang on, only one file is supposed to be produced, obviously. Something odd here. :confused:
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    I've edited my post mwardy... And oh yeah, when processing the Talk To Her recording, the VB scripted bombed out with 'Bad record number' error...
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    son_t wrote: »

    I tried this on Wallace and Gromit (BBC HD) recording of 3.6GB and it produced a 34.2MB file! I tried it on Talk To Her (SD) recording of 2.46GB and it produced a 1.95GB file.

    The processed Wallace and Gromit video file played up to the point where it freezes (HD protection kicks in)... and Talk To Her is as choppy as the original recording played on my Vista machine on the MPC I got working yesterday...

    But the SD file uploaded by Nick123 runs fine here. As I say, the output from this code works in an old version of videoredo which won't open standard foxsat files, so it seems to be doing its job. It's certainly doing something. Are you sure there isn't another problem with your PC setup?

    Clearly it's not working at all with HD--but then you might not expect it to since the file structure will be different, I imagine, since it's h.264, and encrypted at that, which may be carried out by that 4 byte junk sequence (assuming it's still 4 bytes for HD) or may not. That was the point behind my question to jack plug about how you work out the file structure for .ts files.

    A quick search shows that SD broadcast transport streams are mpeg2 data sent in 188 byte packets, but I'm still unclear on how this module identifies the packet start. The next question will be, can the h.264 data be identified in a similar way?
  • mwardymwardy Posts: 1,925
    Forum Member
    ✭✭✭
    son_t wrote: »
    when processing the Talk To Her recording, the VB scripted bombed out with 'Bad record number' error...

    Not good. :(:confused:
  • [Deleted User][Deleted User] Posts: 4,131
    Forum Member
    ✭✭✭
    It could be my PC, but I find the .ts recordings from the HDR vary widely from recordings to recordings... whoever wants to analyse the SD recordings will have to do it on more than just the one file!

    There's no problem playing the SD files - VLC media player does just fine, so the 'junk bytes' might be something not worrying about... But for processing SD recordings, I've just tried the original on HDTVtoMPEG2 and it can't find a channel. After running through the VB script, HDTVtoMPEG is able to read it and process it. So the script is useful after all :)

    The VB script does work on the HD recording - because it works up to the point when copy encryption/protection kicks in... the 35Mb file produce does play. Anyway the result is, that the VB script (stripping of the junk bytes) does not allow Enc BBC HD recordings to be played... (it will only rip upto the enc point...)
  • grahamlthompsongrahamlthompson Posts: 18,486
    Forum Member
    ✭✭
    Here's the vb code with remarks added to explain how it works. You can paste this into vb as the ' character is interpreted as a remark.

    Public Sub trimTS()

    ' Dimension array variable junk to hold 3 bytes

    Dim junk(3) As Byte

    ' Dim array variable a to hold 187 bytes

    DIM a(187) As Byte

    ' Dim Single Byte Constant as 47Hex

    Const sync_byte As Byte = &H47

    ' note this declares variable fni and fno out as a variant will work but Dim fni as string, fno as string is more efficient

    Dim fni, fno

    ' Explicitely define source file path and name

    fni = "H:\" + "Test from Nick.ts"

    ' Explicitely define destination file path and name


    fno = "H:\" + "fixedNick.ts"

    ' open source file to read byte by byte as file 1

    Open fni For Binary Access Read As #1

    ' open destination file to write byte by byte as file 2

    Open fno For Binary Access Write As #2

    ' read first 3 bytes from source file

    Get #1, , junk

    ' read next 187 bytes from source file

    Get #1, , a

    ' continue until first byte in 187 byte block is not 47Hex

    While a(0) = sync_byte
    ' write 187 byte block to output file
    Put #2, , a
    ' read next 3 bytes from source
    Get #1, , junk
    ' read next 187 bytes from source
    Get #1, , a
    ' loop back to while statement
    Wend
    ' close both source and destination files
    Close
    End Sub

    If you stay in the vb editor with the cursor in the sub () line and press f8 you can single step through the code as it runs. Hovering the cursor over a variable name will reveal it's current value. If you open an immediate window you can execute a vb command eg Print fno
Sign In or Register to comment.