3 ms·
I had it extract some general rules from this page and pasted them below: https://video.stackexchange.com/questions/26302/ffmpeg-cutting-3-seconds-at-the-begin
by sharemywin 3y ago
I had it extract some general rules from this page and pasted them below:
https://video.stackexchange.com/questions/26302/ffmpeg-cutting-3-seconds-at-the-beginning-of-a-video-leaves-5-seconds-blank https://video.stackexchange.com/questions/26302/ffmpeg-cutti...
USER
given the following general rules:
1. The issue described in the text occurs when cutting a video between keyframes, resulting in blank video with original sound.
2. Potential solutions include overlaying the copied part with a few seconds of the re-encoded original, seeking to an earlier frame, finding the previous keyframe and clipping from that, or re-encoding the whole clip.
3. FFmpeg does not have a built-in feature to automatically resolve this issue.
Are any of these rules applicable to the question below?
"how do I use ffmpeg to slice out a video. and I only want 3 seconds of video."
ASSISTANT
Enter an assistant message here.
ASSISTANT
Yes, rule 1 and rule 3 are applicable to the question. The issue of cutting a video between keyframes may apply when slicing out a 3-second video using FFmpeg, and FFmpeg does not have a built-in feature to automatically resolve this issue.
USER
Given that what is the answer to the question
ASSISTANT
To use FFmpeg to slice out a 3-second video, you can use the following command:
```bash
ffmpeg -i input.mp4 -ss START_TIME -t 3 -c:v libx264 -c:a copy output.mp4
```
Replace `START_TIME` with the timestamp (in the format `hh:mm:ss`) from which you want to start the 3-second clip. For example, if you want to start at 1 minute and 30 seconds, the command would be:
```bash
ffmpeg -i input.mp4 -ss 00:01:30 -t 3 -c:v libx264 -c:a copy output.mp4
```
However, if you encounter an issue with blank video caused by keyframe cutting, you may need to seek to an earlier frame, find the previous keyframe, or re-encode the whole clip as mentioned in the provided rules.
It seems to be able to find the applicable rules and apply them.
- grayhatter 3y agoI'm not sure what you thought I meant. Or what this is supposed to show. If you tell your text prediction engine to make sure to account for keyframes. It's not impressive that it responds with how to account for them. I know it can use ffmpeg, I haven't seen it attempt to account for well known edge cases, or caveats they way a real expert trying to be helpful would.