Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split video into segments #16

Closed
suntong opened this issue Oct 10, 2021 · 2 comments
Closed

Split video into segments #16

suntong opened this issue Oct 10, 2021 · 2 comments
Labels

Comments

@suntong
Copy link
Owner

suntong commented Oct 10, 2021

ffcvt should allow/help splitting video into several segments.

@suntong
Copy link
Owner Author

suntong commented Oct 10, 2021

Fixed!

Still using the Nice_scenic_videos_from_dashcam_With_Evening_sunset_view.mp4 file,

Nice_scenic_videos_from_dashcam_With_Evening_sunset_view.mp4

With the fixed new ffcvt:

$ ffcvt -force -f "$FFCVT_FTC" -Seg 00:01:20

== Transcoding: Nice_scenic_videos_from_dashcam_With_Evening_sunset_view.mp4
] ffmpeg -i Nice_scenic_videos_from_dashcam_With_Evening_sunset_view.mp4 -speed 2 -af volume=1.6 -c:v libvpx-vp9 -b:v 0 -crf 45 -c:a libopus -b:a 64k -c:s copy -y -f segment -segment_time 00:01:20 -reset_timestamps 1 Nice_scenic_videos_from_dashcam_With_Evening_sunset_view%02d_.mkv

Done.
Org Size: 9765 KB
New Size: 2488 KB
Saved:    74% with 7277 KB
Time: 2m27.7866055s at 2021-10-10 17:47:06

Transcoding completed in 2m27.7871157s
Org Size: 9 MB
New Size: 2 MB
Saved:    74%

$ for f in Nice_scenic_videos_from_dashcam_With_Evening_sunset_view*_.mkv; do echo $f; ffmpeg -i $f |& grep Duration:; done
Nice_scenic_videos_from_dashcam_With_Evening_sunset_view00_.mkv
  Duration: 00:01:21.16, start: -0.006000, bitrate: 278 kb/s
Nice_scenic_videos_from_dashcam_With_Evening_sunset_view01_.mkv
  Duration: 00:01:21.15, start: 0.000000, bitrate: 251 kb/s
Nice_scenic_videos_from_dashcam_With_Evening_sunset_view02_.mkv
  Duration: 00:01:01.87, start: -0.001000, bitrate: 236 kb/s

Note,

  • It’ll cut at the first frame after the time specified with the -Seq option.
  • It gives very accurate splits -- rather than splitting based on a particular time, it splits on the nearest keyframe following the requested time, so each new segment always starts with a keyframe.

@suntong
Copy link
Owner Author

suntong commented Oct 10, 2021

The converted results are:

Nice_scenic_videos_from_dashcam_With_Evening_sunset_view00_.mov
Nice_scenic_videos_from_dashcam_With_Evening_sunset_view01_.mov
Nice_scenic_videos_from_dashcam_With_Evening_sunset_view02_.mov

(the total time doesn't add up to 5:40, because I have to cut short of the source video so as to be able to post here, while leaving the original MP4 header intact. I.e., the actual playable length is only about 3:43).

@suntong suntong added the wiki label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant