![]() By the way the same inaccuracy exists for output seeking if you're doing stream copy. Yeah, it's not frame accurate, can only cut at keyframes, but enough for my application. >Also, input seeking should be inaccurate when doing stream copy And it only happens when stream copy.īelow is a quick showcase: t.ts is the source, and the filenames show how I generate them with FFMPEG (for example, ss_t_i means input seeking -ss first, then -i t.ts, then -t 1:00).Īs you can see, if I use -t/-to before -i, it doesn't cut the file properly. i input file the path to the input file -ss 01:23:45 seek the position to the specified timestamp -vframes 1 only handle one video frame output.jpg output. It literally doesn't stop at the -t/-to timestamp for reason I don't know. The latter has a bug that happens frequently when I'm trimming MPEG-TS files recorded from HDTV. As you can see, the -ss part is before -i, and -t is after. In my Python script, I did input seeking for -ss (start point) part, and then output seeking for -t part (end point). I think I know where you're confused: from the guide it looks like there is only a difference where you put -ss but in reality, where you put -t/-to matters too. (You can also try to use -copyts to keep timestamp, but not recommended because it doesn't work if the video file has non-zero start time.) So instead of using -to, you should calculate -t (duration) yourself by subtracting -ss from -to, and use `-t duration` instead. ![]() However, this way, the timestamp will restart from 0 in output seeking. The best of the two worlds is to use input seeking for -ss and then output seeking for -to. It could be off by a few seconds, or sometimes straight up does not work (for some mepeg-ts files recorded from TV). However, while -ss (seek start) works fine with input seeking, "-to/-t" (seek ending) is somehow vastly inaccurate in input seeking for FFMPEG. The output seeking is very slow (it needs to decode the whole video until the timestamp of your -ss) so you want to avoid it if unnecessary. How to keyframe-cut video properly with FFMPEGįFMPEG supports "input seeking" and "output seeking". Most of them are commercial though, I haven't find one that is free and good.Īlso, seeking in FFMPEG in practice, is actually more complicated than the guide you linked.īelow is a note I keep for own reference for keyframe-copy. There are however, plenty of great software that can but at any frame and only re-encode the frames that are outside the whole GOP. Yeah, it is literally not possible to not seek to keyframe if you are stream copying.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |