Alkl58 / NotEnoughAV1Encodes

GUI for AV1 (aomenc, rav1e & svt-av1)
MIT License
543 stars 24 forks source link

[BUG] ffmpeg -ss and -to option should used as an input option (before -i) #97

Closed YuhaoTang closed 2 years ago

YuhaoTang commented 2 years ago

Describe the bug When use NEAV1E trancoding video, ffmpeg -ss and -to option should used as an input option (before -i)

To Reproduce Steps to reproduce the behavior:

  1. Select split method pysencecut
  2. Select encoder "aom (AV1 ffmpeg)"
  3. Start transcode
  4. In windows task manager, the full ffmpeg command line is something like "ffmpeg -i input.mp4 -ss 00:10:00 -to 00:10:05 ...."

Expected behavior Start and end time should apply to input file and the command line should be "ffmpeg -ss 00:10:00 -to 00:10:05 -i input.mp4 ...." ffmpeg will try to skip the first 10 min rather than deocde them. The output file should be identical in both case, but use -ss as output option will result ffmpeg decode unnecessary parts of the video and waste a lot of time. If a video be splited into 1000 parts, the first part will be decoded 1000 times!

Desktop:

Additional context

ffmpeg Documentation -ss position (input/output) When used as an input option (before -i), seeks in this input file to position. Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved. When used as an output option (before an output url), decodes but discards input until the timestamps reach position.

There are cases that need -ss and -to apply to output file, e.g. create multiple output with different time range, lets say we need create first 5s and first 15s preview of the video: "ffmpeg -i input.mp4 -ss 0 -to 5 first5s.mp4 -ss 0 -to 15 first15s.mp4" This only deocde video once and create two outputs.

Alkl58 commented 2 years ago

I am / was aware of it since the beginning. The problem is that even tho it says that it's frame accurate, it seems to still have issues.

I don't have any statistics, however the amount of people who have video material which has bad frame metadata is pretty high and it seems that the seek as input option is leading to more unwanted issues.

Thats also why it's default to split with transcoding beforehand, as it statistically greatly reduces the probability of missing frames.

YuhaoTang commented 2 years ago

Is there an option to toggle this? Or could you add one in future version? Also I did not see it split the file beforehand when I use pysencecut, the transcode was based on original file, most time was wasted on deocde and skipped.

Alkl58 commented 2 years ago

Optional Input Seeking is included in the new 2.0.7 Release