VideoHelp Forum
+ Reply to Thread
Results 1 to 24 of 24
Thread
  1. Hello everyone.
    I have a MKV file:
    container: Matroska
    Track ID 0: video (V_MPEG4/ISO/AVC)
    Track ID 1: audio (A_AC3)
    Track ID 2: audio (A_AAC)

    What I want is to remove first few frames from it (commercial). Unfortunately MkvToolNix didn't work for me - it also removed first few seconds of the movie. I googled for the solution but didn't find any comprehensive how-to/guide for this. Ideally I would like those frames to be removed with no (or as little as possible) quality loss.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You can only cut at keyframes(and they could be several seconds apart) with mkvtoolnix. Most free editors works like that. But if you are reconverting can you cut exactly, try avidemux...but you will lose quality.

    Or else can you try solveigmm video editor, tmpgenc smart renderer or videoredo. They might support exact cutting and only reconverting around the cut. But they aren't free then.
    Quote Quote  
  3. Originally Posted by Baldrick View Post
    Or else can you try solveigmm video editor, tmpgenc smart renderer or videoredo. They might support exact cutting and only reconverting around the cut. But they aren't free then.
    Thank you. I'll give them a try.

    I was just thinking - if I am watching this mkv file in VLC, the video stream is decoded with H.264 codec to the sequence of frames.
    So is it possible to capture this video/audio stream to a file without any compression, cut out unwanted piece, then pack it back to mkv?
    Quote Quote  
  4. MKV Cutter is free and should be able to cut your file (frame accurate) assuming it's not vfr.
    Quote Quote  
  5. Originally Posted by Dimuk View Post
    I was just thinking - if I am watching this mkv file in VLC, the video stream is decoded with H.264 codec to the sequence of frames.
    So is it possible to capture this video/audio stream to a file without any compression, cut out unwanted piece, then pack it back to mkv?
    The resulting uncompressed video will be on the order or 100 times bigger than the source.
    Quote Quote  
  6. Originally Posted by jagabo View Post
    The resulting uncompressed video will be on the order or 100 times bigger than the source.
    Yes I know it. Now it's 0.7 GB, 20+ minutes. 70 GB - it's gonna be hell to edit, but still it's is possible, right?
    Quote Quote  
  7. sure, but you would then have to reencode the whole thing to get it to a smaller file size -> doesn't sound reasonable at all,..
    Quote Quote  
  8. Originally Posted by Dimuk View Post
    Originally Posted by jagabo View Post
    The resulting uncompressed video will be on the order or 100 times bigger than the source.
    Yes I know it. Now it's 0.7 GB, 20+ minutes. 70 GB - it's gonna be hell to edit, but still it's is possible, right?
    It would be a waste of time. First, the time to produce the uncompressed video is the time it takes to play the video. You could produce an uncomrpessed video with an editor much faster. And to get a small file again you have to recompress the video. Any frame accurate editor does all of that on the fly.

    Many of the free editors don't allow frame accurate editing because they only cut on i-frames. Because they don't have the ability to reencode cut GOPs (they don't have the ability to compress at all). That means no loss of quality (nothing is decompressed, recompressed) but you are limited as to where you can cut.
    Quote Quote  
  9. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    jagabo has the right idea. One reason why free editors lack features (the main feature being competent smart rendering) is that commercial recompression codecs for compliant MPEG/h264/DivX/Xvid output have licensing fees. Oddly, there are some very expensive semi-pro apps out there that don't re-encode that well, and some paid apps won't smart render at all. I'd suggest the trial version of TMPGenc Smart Renderer 4. Has extra features such as transitions, simple audio denoise/volume, etc. Try it. If you like it, get it. It's reasonably priced for what it does, accepts several video/audio formats, works with SD and HD, and has been tweaked over several versions. Members here who are familiar with a freebie might have more ideas.
    Last edited by sanlyn; 21st Mar 2014 at 13:57.
    Quote Quote  
  10. Originally Posted by Selur View Post
    MKV Cutter is free and should be able to cut your file (frame accurate) assuming it's not vfr.
    Yes I was looking towards MKV Cutter. That's how it works:
    create avisynth scripts using the trim calls and LWLibAVSource to decode the GOPs that need reencoding (smart rendering
    After searching here and there I found that reencoding of GOPs is considered to be a loss of quality.Why is it so?
    I mean GOP is decoded with the same codec (same algorithm?) to the sequence of frames, certain frames are removed, then the same codec (same algorithm?) compresses those frames? Other GOPs in the file remains untouched.
    Am I missing something?
    Quote Quote  
  11. Originally Posted by Dimuk View Post
    After searching here and there I found that reencoding of GOPs is considered to be a loss of quality.Why is it so?
    I mean GOP is decoded with the same codec (same algorithm?) to the sequence of frames, certain frames are removed, then the same codec (same algorithm?) compresses those frames? Other GOPs in the file remains untouched.
    Am I missing something?
    Because you are re-encoding those frames within those GOP's. They are decoded and re-compressed. So you incur 1 generation loss . The other unaffected GOP's remain untouched
    Quote Quote  
  12. Originally Posted by poisondeathray View Post
    Because you are re-encoding those frames within those GOP's. They are decoded and re-compressed. So you incur 1 generation loss . The other unaffected GOP's remain untouched
    Because h264 is lossy, right?
    UPD:
    Never mind. It is. I just thought that h264 decreases size by reducing redundancy in the groups of frames, not throwing away any data.
    Last edited by Dimuk; 18th Sep 2013 at 13:29.
    Quote Quote  
  13. Originally Posted by Dimuk View Post
    Originally Posted by poisondeathray View Post
    Because you are re-encoding those frames within those GOP's. They are decoded and re-compressed. So you incur 1 generation loss . The other unaffected GOP's remain untouched
    Because h264 is lossy, right?
    UPD:
    Never mind. It is. I just thought that h264 decreases size by reducing redundancy in the groups of frames, not throwing away any data.
    yes, usually h264 is lossy encoding

    But h264 can be lossless - there is a lossless profile when encoding with x264. But your original video probably didn't use it
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    yes, usually h264 is lossy encoding

    But h264 can be lossless - there is a lossless profile when encoding with x264. But your original video probably didn't use it
    But what if I decode it, trim, then encode in h264 LOSSLESS, will it be worse than it was? Will the resulting quality differ between my original file (.mkv, video track encoded with h264) and my hypothetical decoded, trimmed and encoded to h264 with lossless profile video?
    Quote Quote  
  15. Originally Posted by Dimuk View Post
    Originally Posted by poisondeathray View Post
    yes, usually h264 is lossy encoding

    But h264 can be lossless - there is a lossless profile when encoding with x264. But your original video probably didn't use it
    But what if I decode it, trim, then encode in h264 LOSSLESS, will it be worse than it was? Will the resulting quality differ between my original file (.mkv, video track encoded with h264) and my hypothetical decoded, trimmed and encoded to h264 with lossless profile video?

    quality be the same, but filesize will be much much larger

    File is decoded to uncompressed then re-compressed with lossless codec. The "lossless" codec is with respect to the decoded uncompressed file, not the original

    SO if the original had used the lossless h264 codec, then you get what you want. If the original use the common, lossy variant, you will get much larger filesizes
    Quote Quote  
  16. Originally Posted by poisondeathray View Post
    If the original use the common, lossy variant, you will get much larger filesizes
    But quality of hypothetical file will be the same, compared to the file I have now and can watch in VLC?
    How much is the size increase? 100 times mentioned above?

    Originally Posted by poisondeathray View Post
    not the original
    Original original? I've never saw it, so I don't care how it looked before they compressed it h264 lossy and put it to itunes store. Only thing that bothers me is what diff utility will show when I try to compare same frames from current file and hypothetical trimmed one.
    Last edited by Dimuk; 18th Sep 2013 at 13:53.
    Quote Quote  
  17. Not 100x, more in the order of ~5-15x . It's content and settings dependent . You can use stronger lossless compression or weaker lossless compression. You can watch lossless h264 variant in VLC if your system is fast enough . Slower hardware might have problems, frame drops

    Honestly, I wouldn't bother with itunes crap. You're overdoing / overthinking this . The most I would do is use smart rendering
    Quote Quote  
  18. Originally Posted by poisondeathray View Post
    Honestly, I wouldn't bother with itunes crap.
    Crap?
    Originally Posted by poisondeathray View Post
    You're overdoing / overthinking this.
    Yes, I know. It's not SO important to me. I just actually never mused about how codecs and video processing really works. I could not possibly just take on trust that frame accurate trimming without quality loss is not possible without understanding why.
    Quote Quote  
  19. Yes , crap . Itunes content is watchable, but all the fine details are smoothed away, no grain . But at least it's better than something like youtube for sure

    My opinion - if you're going to bother with doing something lossless, there had better be details there to perserve in the first place , or it must be something important or at least have sentimental value .

    To most people and "untrained" eyes, you're not going to see the difference when using smart rendering anyway
    Quote Quote  
  20. Originally Posted by poisondeathray View Post
    Yes , crap . Itunes content is watchable, but all the fine details are smoothed away, no grain . But at least it's better than something like youtube for sure

    My opinion - if you're going to bother with doing something lossless, there had better be details there to perserve in the first place , or it must be something important or at least have sentimental value .

    To most people and "untrained" eyes, you're not going to see the difference when using smart rendering anyway
    OK. Let's forget about itunes. I just saw that it's quite popular question on different forums. In my opinion, in 21st century increase in size is not much of a problem. So for all perfectionists out there lets answer this question.
    How I do this "the hard way"?
    1. demux my .h264 from mkv
    2. decode .h264
    3. trim
    4. encode to .h264 using lossless profile
    Right?
    Can you advise me the tools to do this?
    Quote Quote  
  21. How many edits are you doing ? Is it just a few commercials ?

    What you propose, is not really a "perfectionist" way of doing things, because you can never get back the original compression when you use a lossless codec . ( It's decoded to uncompressed video, then re-compressed with a lossless codec - so yes, you can get back the uncompressed video with no quality loss, but never the original compression)



    Eitherway, you don't need to demux it

    There are several ways you could do this editing and encoding with x264 lossless . I'm assuming you're wanting to reencode the whole file (you can't smart render only a few sections with lossless profile and join them to non lossless segments - they have to match)

    You could use something like vdub with the mkv import plugin, do the edits in vdub, then export with x264vfw . (When you set crf=0, it will be lossless) . Another way would be to do the edits in avisynth, use x264 - probably more complicated if you're not already familar with avisynth

    Also , there are other lossless codecs to choose from . Some are more compressed (smaller filesizes) , some offer better playback (less compressed, but faster , smaller decoding latency) , some are more compatible in various programs
    Quote Quote  
  22. VideoRedo can edit MKV and will only reencode cut GOPs.
    Quote Quote  
  23. Originally Posted by Dimuk View Post
    Hello everyone.
    I have a MKV file:

    What I want is to remove first few frames from it (commercial). Unfortunately MkvToolNix didn't work for me - it also removed first few seconds of the movie. I googled for the solution but didn't find any comprehensive how-to/guide for this. Ideally I would like those frames to be removed with no (or as little as possible) quality loss.
    same problem with me as well

    [QUOTE=Dimuk;2268003]
    Originally Posted by Selur View Post
    MKV Cutter is free and should be able to cut your file (frame accurate) assuming it's not vfr.
    Yes I was looking towards MKV Cutter. That's how it works:

    Did that work? is it lossless cut of the mkv without any further encoding? I want to trim a mkv based on frame no. without any re-encoding?
    Quote Quote  
  24. You can't randomly cut in non-lossless encoded mpeg based files without any reencoding.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  



Similar Threads

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