VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. Member
    Join Date
    Nov 2008
    Location
    Romania
    Search Comp PM
    I am trying to encode a h264 ts file to x264 (.mkv) or xvid (.avi). First of all, i demux the ts (using tsmuxer) to a .264 file (video) and an audio file. Then i make an avs file with the following:

    DirectShowSource("C:\path\file.264",fps=25,audio=f alse)
    crop( 0, 0, 0, -2)
    LanczosResize(624,352) # Lanczos (Sharp)

    Then i open it in megui, and i also add the audio. The problem is that the encoded video is missing 1 or 2 minutes at the end: for a xvid video if the duration is 50 minutes, the encoded video drops at about 48-49, for the x264 the image hangs out at the same time-code, but the audio goes to the end.
    Any suggestions?
    Quote Quote  
  2. Cut out the error segment

    You can try tsmuxer, or h264ts_cutter

    This commonly happens with transport streams. There is timing information in the .ts, that is lost when you change containers or encode to something else. Furthermore, drop outs and glitches cause desync at every "error point", so if you have multiple error points, you have a lot of segements to process

    Good Luck
    Quote Quote  
  3. Member
    Join Date
    Nov 2008
    Location
    Romania
    Search Comp PM
    The .ts is already cutted with h264cutter. The problem is that the video drops out at the last minutes and I need them too. It only happens for the last 1 or 2 minutes, the other part of the encoded video works ok, no sync problems, etc. I can cut the encoded video with mkvmerge for example, but I need exact filesize.
    Quote Quote  
  4. If you cut the original .ts into segments before, thus eliminating the "bad" segment, and then later on, do 2 encodes, and join them together it should work. Does the .ts play normally in a media player? Can you seek to a "good" portion after the error point? If it doesn't, it's probably too damaged

    The "glitches" usually cause either the audio, video or both encoders to stall and thus you get desynch or even aborted process as you saw with x264.exe

    If you can playback the original .ts in a directshow player, like mpc, and it plays normally "over" the error point, it is because it re-synchs itself after reading the timing information, and can often ignore errors

    If this doesn't work maybe try using DirectShowSource() on the file.ts, instead of the raw .264, because the .ts has timing information, where the raw .264 does not.

    If you get the interval precise around the error point, you sometimes can "skip" over the bad segment just with avisynth e.g.

    Trim(0,100)++Trim(200,300)

    In this, the "bad segment" is between frames 100-200. The corresponding audio would need to be encoded with the same script.

    DirectShowSource() for this can sometimes cause sync-issue problems (because it's not necessarily frame accurate), and you may want to use DGAVCdec instead, which indexes the file and usually gives more consistent results

    The last option is using vdub and the directshow input driver, which seems to "record the errors as you play", so even streams with dozens of errors are preserved, but it doesn't always work, and you are limited to .avi container, without AAC (although you could extract the video and transcode the audio from a .wav to AAC and swap containers). But if the original .ts doesn't even function properly and you can't cut out the bad segments it's unlikely you will get a proper fix

    Good luck
    Quote Quote  
  5. Member
    Join Date
    Nov 2008
    Location
    Romania
    Search Comp PM
    It worked using the direct show source to the .ts instead of the .264. Thanks a lot.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!