VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    Hello,

    I am basically trying to cut and rejoin different parts from a .mkv encoded with x264/AVC using avidemux. Because I dont want to lose quality by re-encoding (and waste time), I am trying to do a direct stream copy. The problem is that I cannot select arbitrary frames for the chunks; only keyframes as the begnning of the segments. To circumvent this restriction I am trying to re-encode just the smallest portions between keyframes and patching up everything together.

    This image should give you a better idea on what I am doing:


    But what happens is that the direct stream copied chunks and the re-encoded chunks are incompatible even though they have the same codec, same FPS and same resolution. I can join them in the same file, but the video will either crash or the image will be messed up after "transitioning" between the two.

    I used MKVInfo and I found out that everything is the same, except the CodecPrivate thing. I presume that the best I can try to do is to re-encode the smaller chunks with the same settings as the original ones so their CodecPrivate info will be the same. Is there any program I could use to determine these settings (eg. parse CodecPrivate)?

    Thank you.
    Quote Quote  
  2. Not sure what "codecprivate" is?

    mediainfo and avinaptic might give you some more information

    Did you try doing it all at once in avidemux? What I mean is instead of cutting pieces then appending them, just cut the unwanted pieces out then save all in 1 go?
    Quote Quote  
  3. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray
    Not sure what "codecprivate" is?

    mediainfo and avinaptic might give you some more information
    Thanks, avinaptic showed me the info I need. I am just trying to reproduce those settings. By any chance, does anyone have an older build of x264 for windows? Like 662.

    Did you try doing it all at once in avidemux? What I mean is instead of cutting pieces then appending them, just cut the unwanted pieces out then save all in 1 go?
    Is that possible?
    Quote Quote  
  4. Theoretically it's possible, just like in vdub with avi's, but I just tried on a sample clip and it was "jerky" between cuts.

    Here are the archive builds for the cli version
    http://techouse.project357.com/archive.html

    Curious to see if it work out, please report back
    Quote Quote  
  5. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    OK folks, after a lot of headache and trial and error, I finally did it.
    Basically, what I did for the parts that needed re-encoding (see 1st post) was :

    1. Extracted them to AVI as raw (YV12 and PCM - it won't work otherwise) using AVIDemux.
    2. Re-encoded them using the exact same settings the original file used. Thanks to avinaptics it was possible to see what they were. To be on the safe side, I even used exactly the same x264 build that was used for the original video.
    3. Because of some weird bug with AviDemux that won't let me open the .mkv files made by x264 (maybe because it's an old version) I had also to use mkvtools to demux and mux the video track again.

    After all this work, I was finally able to join the segments smoothly with avidemux.
    I even made a .bat file to automate part of the process:

    Code:
    @ECHO OFF
    IF [%1] ==[] GOTO Syntax
    IF [%2] ==[] GOTO Syntax
    
    x264 --progress --bitrate 900 [whatever options] -o temp.mkv %1 640x480
    mkvextract tracks temp.mkv 1:track.264
    mkvmerge -o %2 --default-duration 0:23.976fps track.264
    del track.264
    del temp.mkv
    del 264.stats
    GOTO End
    
    :Syntax
    ECHO.
    ECHO Usage: enc264 infile outfile (resolution=640x480)
    ECHO.
    
    :End
    And all this trouble pays off, because I can save a lot of time by just re-encoding small parts of the video and the quality difference is barely noticeable.

    Thank you all for your help.
    Quote Quote  



Similar Threads

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