[FFmpeg-devel] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding

Lynne dev at lynne.ee
Tue Aug 20 15:36:53 EEST 2024


On 20/08/2024 14:13, basj at gget.it wrote:
>>> More generally, which is the recommanded way to cut a video with a specific starting point and specific length, with minimal re-encoding?
>>> Millions of hours of CPU-time are probably wasted to reencode already-perfectly-encoded content, just for cutting ;)
>>
>> Only do remux without transcoding, and let mp4 muxer use editlist to strip the timeline from IDR to the requested start time.
>> The preroll at the beginning can be slow when playback, but seeking also has the same preroll
>>
>> Other choice is use multiple groups of SPS/PPS in mp4 sample description. We have that support in mp4 demuxer, but not
>> in muxer. It’s standard in specification but not widely supported. So if we add support to muxer and it works with our own
>> demuxer, it’s not surprise to experience a lot of compatibility issues with other software.
> 
> Thank you Zhao for your answer.
> 
> Is there a feature already available in ffmpeg to use one of your 2 solutions?
> Or is someone already working on this topic? (if so, can I join this feature development?)
> 
> In any case, if someone has a solution, many people are looking for a solution for this, either here: https://stackoverflow.com/questions/63548027/cut-a-video-in-between-key-frames-without-re-encoding-the-full-video-using-ffpme (closed),
> or here: https://superuser.com/questions/1850814/how-to-cut-a-video-with-ffmpeg-with-no-or-minimal-re-encoding.
> It would help many people if a ffmpeg-expert could help on this :)

AVTransport, the new container I'm working on, supports more flexible 
signalling of decoded but discarded refs. Still WIP so no support for it 
in FFmpeg, but hopefully not for too long.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240820/6cec489e/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240820/6cec489e/attachment.sig>


More information about the ffmpeg-devel mailing list