Hi author, thank you for developing and maintaining this useful WebM clipping script.
I noticed that the script currently uses --start and --end parameters to specify the clip range. This approach relies on keyframe (I-frame) seeking, which means the actual starting point can be several seconds to tens of seconds earlier than the specified time when the video has a large GOP. This makes it impossible to achieve frame-exact clipping.
I understand this may be for performance reasons (fast seeking), but in scenarios where precise clipping is needed (e.g., capturing a specific frame, aligning subtitles), this limitation becomes noticeable.
I experimented by adding a toggle option (precise_trim) to the script. When enabled, it uses lavfi-trim + setpts for video and atrim + asetpts for audio to achieve frame-exact trimming, while removing --start/--end. In my tests, it does achieve frame-level precision, though encoding startup is slightly slower (due to decoding extra frames before the target point).
I'd like to ask:
- Is using
--start/--end by default a performance consideration, or are there other reasons (e.g., compatibility)?
- Have you considered adding an optional toggle so users can choose between "fast" and "precise" modes based on their needs?
- Is my approach of adding
trim filters reasonable, or do you have a better implementation suggestion?
If this feature would be valuable to the project, I'd be happy to submit a PR or provide my modification details.
Thanks again for your work!
Hi author, thank you for developing and maintaining this useful WebM clipping script.
I noticed that the script currently uses
--startand--endparameters to specify the clip range. This approach relies on keyframe (I-frame) seeking, which means the actual starting point can be several seconds to tens of seconds earlier than the specified time when the video has a large GOP. This makes it impossible to achieve frame-exact clipping.I understand this may be for performance reasons (fast seeking), but in scenarios where precise clipping is needed (e.g., capturing a specific frame, aligning subtitles), this limitation becomes noticeable.
I experimented by adding a toggle option (
precise_trim) to the script. When enabled, it useslavfi-trim+setptsfor video andatrim+asetptsfor audio to achieve frame-exact trimming, while removing--start/--end. In my tests, it does achieve frame-level precision, though encoding startup is slightly slower (due to decoding extra frames before the target point).I'd like to ask:
--start/--endby default a performance consideration, or are there other reasons (e.g., compatibility)?trimfilters reasonable, or do you have a better implementation suggestion?If this feature would be valuable to the project, I'd be happy to submit a PR or provide my modification details.
Thanks again for your work!