Skip to content

Avidemux cuts more accurately than losslesscutΒ #1786

Closed

Description

@vkopey

I have a lot of issues to go through, so in order to make it easier for me to help you, I ask that you please try these things first

Description

Has the author tried working with Avidemux? Avidemux cuts EXACTLY on key frames. But this program does not. Maybe the reason is in ffmpeg?

Activity

  1. mifi commented on Nov 23, 2023

    @mifi
    Owner

    Not sure what you mean by that. Losslesscut can also cut on keyframes if you jump to keyframes when setting cutpoints

  2. vkopey commented on Nov 23, 2023

    @vkopey
    Author

    Yeah, I know. But Avidemux cuts EXACTLY on the key frame and does not capture adjacent ones. Just compare the cutting quality, for example, in the MKV video AVC1+AAC.

  3. mifi commented on Nov 24, 2023

    @mifi
    Owner

    LosslessCut also cuts on keyframes, because it's not possible to cut outside keyframes. Or what do you mean exactly? Do you have a concrete example of an example file with some cuts that we can compare?

  4. mifi commented on Dec 2, 2023

    @mifi
    Owner

    thanks. so the problem is that with losslesscut you get output files with an empty portion at the beginning of each file that you cannot seek to, right? i tried to change format to mp4 using losslesscut and then the result seems to be identical to avidemux. also did you use copy mode in avidemux?

  5. changed the title [-]Avidemux has better cutting quality[/-] [+]Avidemux cuts more accurately than losslesscut[/+] on Dec 2, 2023
  6. mifi commented on Dec 2, 2023

    @mifi
    Owner

    related #1216

  7. vkopey commented on Dec 2, 2023

    @vkopey
    Author

    Yes, you understood correctly. And I used copy mode in Avidemux. I will also try to cut mp4 instead of mkv and write the result here.

  8. Dean-Corso commented on Dec 3, 2023

    @Dean-Corso

    Hi guys,

    so I told about that problem of key frame cuttings a longer time ago and it still exists unfortunately. First problem is displaying the right frame position in LC at all. Just load any MP4 / MKV container video which stats with any color what does change on any location or using any timer / counter anything where you can see the differences on every frame change. I made a frame counter on any video to show every single frame with a number. Now you can load the video in LC / AviDemux / VirtualDub etc you can compare it. In case of LC it starts with frame 0..

    LC = 00:00:00.000(0)
    AD = 00:00:00.000
    VD = 00:00:00.000 | 0
    

    ...and on every first image frame I can see value 1 which is marked as 1 of course. Now when I just step forward one single frame in all tools then I should get value 2 to see what also happens in AD & VD but not in LC so this tool still does show value 1 and not value 2. LC did only add the time value of 00.040 what is the length of one frame in my example video but LC did not display the correct frame. Below 2 images...

    Frame 1

    Frame1_2023-12-03_012257

    ...all starting at frame 1 time 00:00:00.000. Now when I step forward one frame we get this to see...

    Frame 2

    Frame2_2023-12-03_012257

    ...so LC is still showing same frame 1 instead of frame 2 and only the time did seek forward for 0.040 (1). Why? Why does the frame not change? Now we have same problem when seeking to any key frames in the video so lets have a look.

    Key Frame Selection

    Frame3_2023-12-03_012257

    The selection seems to same on all three tools but LC does display the wrong frame (one behind). That's also confusing when user wanna do some accurate cuts by hitting the RIGHT frame and in this case the user can not hit it as you can do and see in AD & VD.

    Next problem is when you try to make a Key frame cut then it can fail when not using the right export settings. Problem I see is for example the -avoid_negative_ts option in FFmpeg. So here you can get different results out what is also confusing because the error rate is high and before you do a KF cut you should make a test cut before to know what setting to use in case of -avoid_negative_ts. Here it can fail you don't get that out what you did cut in LC. Sometimes it does not work or works wrong so this is a problem. In case of KF cuttings I still have to use AD instead of LC because it's not failing in copy mode with the videos which do fail when using ffmpeg with or without LC.

  9. mifi commented on Dec 3, 2023

    @mifi
    Owner

    The problem with losslesscut showing frame 1 for the first few frames seems to be an issue with the HTML5 video player. If you do the same in Google Chrome (or even Safari), e.g. open a video file with 30fps and you seek to the second frame (using document.getElementsByTagName('video')[0].currentTime = 0.033), it will still show the first frame. This doesn't happen with all files and I don't know why that's happening, but essentially it means that for some videos, the frame you're seeing in the preview is not the actual frame you're at.

  10. Dean-Corso commented on Dec 3, 2023

    @Dean-Corso

    Hi again,

    so I made some more tests with my frame number video and tried using every convert format I could choose in your LC tool to load that video. Unfortunately I found no method what is working correctly for 100 % so that's the bad news. All methods showing displaying issues on any frame XY position not showing the right frame or DO NOT showing a frame (some skip issue) and showing the pre frame instead or showing any random frame. So this is of course a major problem in video editing world. Rule number one - Cut what you see. Otherwise you video editing / cuts will not match for 100 % in your final output results. Accurateness should be the A & O.

    So you know I do like LC of course and would also like to use it at all but those alleged things make it hard to trust in LC cuttings we made what means it's somehow unsafe and your final results could not match as the user wanted specially in case of important video editing etc. Not sure whether you can do anything about it to let display everything / every frame correctly without to skip showing ANY frame or over jumping ANY frame etc you know. Just use any video with an frame counter (every frame has a number) without any double frames inside (30 seconds are enough) and then test it out.

    So if you would find & fix that problem then it would be very very good you know. So in VirtualDub I have also an QuickTime plugin to load video with and this has some similar issues displaying the right frames and the ffmpeg driver also has some little issues and only the cached input driver in VD2 is showing every frames correctly. As I said, if you can do anything about it then it would be great.

  11. mifi commented on Dec 5, 2023

    @mifi
    Owner

    LosslessCut is first and foremost designed to make rough cuts in raw footage to cut away unused footage in order to reduce the size of files. I think even if the start/end of a video is not perfect (wrong frame number, missing a few frames, rearranged frames etc), that's ok for most people, as you can just include a little extra before/after the cut start/endpoints to make sure that you get everything. I see that it's a problem for people who cut+merge, but TBH I don't know how to fix it, because the problems don't seem to be consistent between different files, and ffmpeg and html5 video editor works differently, as mentioned above. If anyone has suggestions, I'm open to hear, but as of now there's nothing actionable for me on this.

  12. bryc commented on Jan 4, 2024

    @bryc

    Question: In LosslessCut, when you navigate to a key frame and use it as the end time for the current segment, is the key frame itself intended to be inclusive or exclusive?

    In other words, is LosslessCut intended to include the keyframe itself as the final frame of the segment?

    When cutting MP4 files (H264 + AAC), I've noticed the output often contains more frames than I intended it do. It always contains the final key frame in the output, plus some extra frames. Seems to vary, anywhere between 3 or 8 extra frames, depending on the video. It's always like this, so I've developed the technique of cutting 3-5 frames early to compensate for this and just crossing my fingers.

    Looking at Avidemux, it seems that when you cut directly at a key frame, the output itself stops on the frame just before the key frame (and does so seemingly reliably), and the final key frame itself is never included in the output. But I do notice that sometimes a frame gets duplicated here and there in the output, which is very confusing, but I suppose it's done to pad audio frames or something like that.

    It would be nice if a way to approximate the behavior of Avidemux's end marker cutting was possible, so that a user has a more reliable way to know exactly what the final frame in the output will be. Or at the very least, a way to reliably ensure that it stops right before the final key frame.

    When I want more precise control over the final frame, I have to do a lot of manual checking. For example, in one random video, I had to cut 3 frames before the keyframe in LosslessCut, to match the same ending frame as Avidemux does when it cuts right on the key frame itself. It'd just be nice to have a more direct and reliable way of cutting the end point.

    But I do understand if there are limitations to the HTML5 + FFmpeg system that might not make this possible.

  13. mifi commented on Jan 5, 2024

    @mifi
    Owner

    Yea I haven't found a definite answer, see #1216
    it seems to depend on the particular file you're cutting, so I simply don't know how to make it never include the last keyframe and make it work with all files.

  14. mifi commented on Feb 16, 2024

    @mifi
    Owner

    I'm closing this because I believe it's the same as #1216 - note that the next version of llc will have an export option to auto shift all cut-start times forward by X frames

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions