Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: basj@gget.it
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding
Date: Mon, 05 Aug 2024 19:45:24 +0000
Message-ID: <2baccf0f-8973-4370-9fc0-9d4df8e45a18@mtasv.net> (raw)

Hi,

Before trying to develop a new feature, and diving in the code base, I wanted to know if it currently exists, or is already in a work-in-progress task:

When cutting a video with no re-encoding:

    ffmpeg -ss 120 -t 60 -i input.mp4 -c copy output.mp4

the result is often choppy or non-smooth in the first seconds, because the cut point doesn't necessarily coincide with a keyframe, at least on some players (such as Media Player Classic, etc.).

Some more complex solutions involve reencoding just the beginning until the next keyframe, and then use copy codec for the rest of the video, and then concatenating, all of this requiring multiple calls of ffmpeg.

Is there a feature already in development that would allow to do this in one single pass of ffmpeg, without multiple calls and concatenation?

Something like:

    ffmpeg -ss 120 -t 60 -i input.mp4 -c copy -reencodebeforekeyframe output.mp4

Thanks,
Basj
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2024-08-05 19:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 19:45 basj [this message]
2024-08-13  7:35 basj
2024-08-13  8:55 ` Timo Rothenpieler
2024-08-14 10:05 basj
2024-08-14 11:42 ` Zhao Zhili

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2baccf0f-8973-4370-9fc0-9d4df8e45a18@mtasv.net \
    --to=basj@gget.it \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git