VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy PlayOn (record Netflix) :)
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Hello

    I used eac3to on an mpls file (ripped blu-ray disc) to produce video, audio, and subtitle streams (H264, DTSMA, PGS formats). I then fed these raw files into mkvtoolnix GUI to remux into an MKV file, but also inserted timecodes into the "splitting" field under the "output" tab. My intention was to split in order to cut out the parts of the film I didn't want by simply deleting the relevant MKV files and re-merging the remaining MKVs using mkvtoolnix again.

    Unfortunately I've noticed an issue with the resulting final product. At the points in the film where the mkv files were stitched together, the audio continues to play seamlessly but the video will pause for a few seconds before skipping ahead. The video and audio then remain in sync.

    Any ideas what could be causing this?

    Thanks

    Odai.
    Quote Quote  
  2. It could be because the Blu-ray uses OpenGOP. Cutting can be problematic at non-IDR-I-frames. Or it is because the cuts are of different lengths (video can only be cut on keyframes). Can't say for sure without samples and knowing the exact procedures.
    Quote Quote  
  3. Many thanks for your reply.

    Apologies, I'm quite a novice when it comes to the technical details. My understanding from your post is that your reference to the cuts being of different lengths means that the video and audio streams in a given file after the split are not equal in duration (that the audio is possibly longer than the video in each file), and that a possible explanation is that the timecodes specified for the splits do not correspond to the location of keyframes in the video stream. My understanding is that, when the split files are re-joined, at the split point the video essentially pauses (while the audio continues) until the next keyframe appears and the video then skips to and resumes at this point in the stream. Is this more or less a correct understanding?

    However, as far as I'm aware, mkvmerge does not support splitting except at keyframes anyway, so if the timecodes I specified do not actually correspond correctly to keyframes wouldn't mkvtoolnix just ignore these timecodes and split at the closest keyframe instead?

    Furthermore, if I try to play each of the individual split files separately before re-joining them they play fine. This includes the first few seconds of each file that is skipped when I try to re-join the ones I want together. If these first few seconds of each file didn't actually start with a keyframe, wouldn't playing them be impossible? I also tried repeating the process of rejoining the separate files but this time leaving out all audio and subtitle streams so that only the single video stream remains. The exact same issue persists however.
    Last edited by Odaik; 19th Mar 2017 at 13:36.
    Quote Quote  
  4. The problem is that for mkvmerge a "keyframe" is a frame you can seek to. For H.264 video that is either an IDR frame or an I frame that's a recovery point. This is ok for playing back a complete file but not for editing. So editing using mkvmerge is not safe for these files. How these are played depends on the player. They may appear fine in one player but garbled or with pauses in a different one.
    But without a sample I cannot say what the problem is.
    Quote Quote  
  5. Thanks again for the input.

    I guess I can read into it a bit more and try and solve the issue myself, maybe after asking a few more specific questions on here. Until today I actually had no idea what I, P, and B frames were.

    If I were to just upload a sample, any suggestions on the best method for this? Just a little concerned on the legal side too, as I'd be uploading a significant amount of footage extracted from a (copyrighted) blu-ray title.
    Quote Quote  
  6. Just cut about 30 to 60 seconds from the beginning of the first m2ts using e.g. DGSplit or TSMuxer.
    Quote Quote  
  7. In the meantime, can you recommend any programs that will allow me to edit mkv files in the way I wish (without re-encoding) and not encounter these issues?

    EDIT: Sorry, posted before refreshing the page there and didn't see your post. Would uploading that footage give you enough information on how the tracks are mastered to determine what the issue could be, or would you also need the split files themselves?
    Quote Quote  
  8. Good question. I actually don't know. Usually, you'd find the IDR frames and only cut at those, at least for the GOPs you want to keep (beginning of a segment). Otherwise try mp4box or SolveigMM Video Splitter.
    Quote Quote  
  9. I think I'm slowly getting my head around it all now. Assuming the issue is all down to not cutting in the right place, is there any software out there with a GUI that will allow me to analyse the video stream composition and determine the timecodes for where the IDR frames are?

    By the way, am I correct in understanding that a GoP is a group of frames that can all be decoded together entirely without reference to frames outside of the GoP, and that therefore they must start with an IDR type I-frame?
    Quote Quote  
  10. Originally Posted by Odaik View Post
    By the way, am I correct in understanding that a GoP is a group of frames that can all be decoded together entirely without reference to frames outside of the GoP...?
    What you are describing is a "closed GOP". As was mentioned earlier there are also "open GOPs" that require frames of the next GOP to decode the last few frames of the GOP.
    Last edited by jagabo; 20th Mar 2017 at 20:50.
    Quote Quote  
  11. Thanks for the explanation, that clears it up a little for me.

    Is there any easy way I can analyse the stream to determine these parameters? I.e whether cuts contain open/closed GOPs, location of IDR frames etc...
    Quote Quote  
  12. l-smash muxer and mp4box will show number of IDR vs "just" I frames during mux. That should give a strong hint about how source was encoded. Other than that you need some kind of stream analyzer like Zond.
    Quote Quote  
  13. OK, so I used a trial of SolveigMM Video Splitter to analyse the video stream and re-attempt the cuts I did with mkvmerge originally.

    By using the "Next K Frame" navigation feature, it seems that throughout the film keyframes occur every second or so. So that's 1 in 24 frames that are keyframes (I'm assuming in this case that this is synonymous with IDR type I frames).

    Does this sound like a stream encoded with Open GoPs? 1 in 24 doesn't sound like a lot of keyframes.

    I did try and cut out the parts I didn't want using this software and it worked fine. So it seems something is going wrong when I attempt to do the same in mkvmerge. I guess one option now is to copy the timecodes for keyframes identified in SolveigMM and use those to split in mkvmerge.
    Quote Quote  
  14. Originally Posted by Odaik View Post
    Does this sound like a stream encoded with Open GoPs? 1 in 24 doesn't sound like a lot of keyframes.
    1 in 24 is quite a bit and common on Blu-ray due to its specifications. For example x264 uses 1 in 250 by default.

    Originally Posted by Odaik View Post
    I did try and cut out the parts I didn't want using this software and it worked fine. So it seems something is going wrong when I attempt to do the same in mkvmerge. I guess one option now is to copy the timecodes for keyframes identified in SolveigMM and use those to split in mkvmerge.
    SolveigMM Video Splitter has smart re-encoding. You may find it working on cuts mkvmerge does not.
    Quote Quote  
  15. There does seem to be something else going on that SolveigMM is able to address and and that mkvmerge isn't, as you suggested. I tried simply taking the timecodes for the keyframes as found using SolveigMM and using that to split the MKV using mkvmerge, expecting the same seamless results.

    Unfortunately I still get the exact same issue. Re-joining the split parts using tsmuxer instead (so exact same except end result is a m2ts container) also has the same problems at the same points in the film.

    I would just stick to SolveigMM, except it doesn't seem to recognise my subtitle or audio streams and obviously is also fairly expensive after the evaluation period.

    I am still hoping that the issue is simply to do with not cutting at keyframes and that maybe I am feeding the wrong timecodes to mkvmerge. My current process is to simply find the keyframes I want to split the file at (so the first keyframe of the scene I want to cut out and then the first keyframe of the scene right after - idea being everything in between can then be deleted). I then look at the time stamps for these frames. SolveigMM gives this in a HH:MM:SS,NN format; where NN are the two digits of an integer frame number in that second of video (if I've understood correctly). So 01:01:22,06 is the marker of the 6th frame of that second of footage. The way I get the exact timecode for mkvmerge is to take that stamp, copy the HH:MM:SS part, and as mkvmerge requires a decimal timecode (HH:MM:SS.nnnnnnn...) I consider the position of the exact frame as a fraction of a second. So for example the 6th frame in each second begins at ( 5 * (1/23.976) ), and I put this figure (less than 1) after the decimal point in HH:MM:SS.nnnnnn. So the 5th frame each second occurs at HH:MM:SS.208541875...

    Does this sound like a correct workflow to achieve what I want, or am I missing something?
    Quote Quote  
  16. You can tamper with mkvmerge's timing as much as you want but it won't solve your problem. Like I explained earlier mkvmerge will only cut on "keyframes" (the next after the specified time so it does not have to be 100% exact, you could even set it a bit before) but there are two kinds of those (IDR and non-IDR). mkvmerge can only cut safely on IDR frames. A good encoder will put those on scene changes and deviate from the strict 1-in-24 pattern for that. A bad encoder would put only a single IDR frame in the entire movie. No luck cutting with mkvmerge, then.
    Quote Quote  
  17. You can use ffprobe (comes with ffmpeg) to see type type (and lots of others properties) of every frame. It displays frames in presentation order so you can differentiate open and closed GOPs by whether the frame before an I frame is a B frame (open GOP) or a P frame (closed GOP). After installing ffmpeg, put this in a batch file:

    Code:
    "G:\Program Files\ffmpeg\bin\ffprobe.exe" -print_format json -show_frames %1 > %1.txt
    Change the path to ffprobe to reflect where it is on your system. You can then drag/drop any file onto the batch file and it will generate a log of all the frames. The log filename will be the same as the video filename except ".txt" is added to the end. So "video.mkv" becomes "video.mkv.txt". If you use this on your source video, the split videos, and the re-joined video you should be able to tell if any frames are missing or duplicated.
    Quote Quote  



Similar Threads