[FFmpeg-user] Is there a way to cut a video at an exact time ?
Mark Filipak
markfilipak.imdb at gmail.com
Sun Apr 14 06:45:55 EEST 2024
On 13/04/2024 17.27, Jim Worrall wrote:
>
>> On Apr 13, 2024, at 01:57, bbb <ffmpeg-user at bugblatterbeast.de> wrote:
>>
>> Sorry for bothering you. It only behaves like this when I use "-codec copy". Without that option it accepts the exact time I've specified.
>>
>> On 4/13/24 13:47, bbb wrote:
>>> I want to cut off the start of a video. When I tell ffmpeg to start at an exact time, it refuses to do so and instead starts at a time that's somehow "convenient" for ffmpeg. I can only assume that it's probably depending on something like a keyframe or an important frame for the compression algorithm but I don't really know.
>>>
>>> the command:
>>> ffmpeg -ss 0:32.08 -i video.mkv -codec copy -map 0 video.cut.mkv
>>> makes the output start around 0:31 (even when I change the parameter value a bit, the result is exactly the same).
>>>
>>> Is there a way to make ffmpeg start at the exact time that I specified?
>>> Does it maybe depend on the codec and would it help if I recode it before cutting?
>>>
>>> It would be even better if I were able to start at a specific frame number but I didn't find a parameter to set that. To set a frame offset seems only possible when you're exporting to images.
>>> _______________________________________________
>
> I think this has everything you need to know. Bottom line as I understand it: it’s not possible to cut video precisely while copying streams.
> https://trac.ffmpeg.org/wiki/Seeking
-bsf:v noise=drop='lt(pts\,503957216)' //cuts frames that have PTS<503957216.
The noise -- yes, noise -- bit stream filter works -- thank you, Gyan. But it doesn't work right
with open GOPs. I'm trying to craft a workaround for the errors. However, right now I'm busy working
on determining whether TS streams include nav packets.
--Mark.
More information about the ffmpeg-user
mailing list