Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyframe cut mode bug? #1795

Closed
5 tasks done
plztrial4me opened this issue Nov 30, 2023 · 1 comment
Closed
5 tasks done

Keyframe cut mode bug? #1795

plztrial4me opened this issue Nov 30, 2023 · 1 comment

Comments

@plztrial4me
Copy link

plztrial4me commented Nov 30, 2023

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

Operating System

Windows 10

Steps to reproduce

The input and output files I used for our tests are shared in the Google Drive link below.
https://drive.google.com/drive/folders/1cXTjbB4ooRaePtBhRgN9-nseS59oTibL?usp=sharing

The keyframes for the input file are shown below.

0.000000 (framnum=0)
3.000000 (framnum=90)
6.000000 (framnum=180)
9.000000 ...
12.000000
15.000000
18.000000
21.000000
24.000000
27.000000
30.000000

Expected behavior

If you cut using the key frames 3.000000 (framnum=90) and 6.000000 (framnum=180) for both the start and end points, the result should be framed from 90 to 179.
(Note that FFMPEG does not include the last frame).

Actual behavior

However, if you look at the output, it contains frames 90 to 179, as well as 180 (I frame) and 184 (P frame).
(Note that frames 181-183 are not included; they are all B frames).

I'm assuming this is an FFMPEG bug.

Singularity

  1. When cutting with stream copy method for the same point in avidemux, the result is 90 to 179, the same as the expected behavior.
  2. Even if the input file consists of only I frame and P frame, the result is changed from 90 to 179 when using ffmpeg.

Share log

The ffmpeg command executed by losslesscut.

ffmpeg -hide_banner -ss '3.00000' -i 'D:\sample-framenum.mp4' -t '3.00000' -avoid_negative_ts make_zero -map '0:0' '-c:0' copy -map '0:1' '-c:1' copy -map_metadata 0 -movflags '+faststart' -default_mode infer_no_subs -ignore_unknown -f mp4 -y 'D:\sample-framenum-00.00.03.000-00.00.06.000.mp4'

@mifi
Copy link
Owner

mifi commented Dec 2, 2023

I can reproduce the problem.

  • Only if I cut to 05.933 = frame 178 (instead of 06.000 = frame 180), then the last frame visible in the output video is 179.
  • If I cut to 05.900 (frame 177) then the last visible output frame is 178
  • If I cut to 05.867 (frame 176) then the last visible output frame is still 178
  • If I cut to 05.833 (frame 175) then the last visible output frame is still 178
  • If I cut to 05.800 (frame 174) then the last visible output frame is still 178
  • If I cut to 05.767 (frame 173) then the last visible output frame is still 178
  • If I cut to 05.733 (frame 172) then the last visible output frame is 174

according to avidemux

  • frame 184 in an P-frame
  • frame 183 in an B-frame
  • frame 182 in an B-frame
  • frame 181 in an B-frame
  • frame 180 in an I-frame
  • frame 179 in an P-frame
  • frame 178 in an P-frame
  • frame 177 in an B-frame
  • frame 176 in an B-frame
  • frame 175 in an B-frame
  • frame 174 in an P-frame
  • frame 173 in an B-frame
  • frame 172 in an B-frame

not sure what to make of this though. Unfortunately I will have to close this because there's nothing I can do about this problem, but I added a reference to this issue in #1216

If any more information comes up, we can re-open.

@mifi mifi closed this as completed Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants