Reputation: 21
Recently I had a task to process several thousand videos, both .mp4 and .webm. The goal was to cut 1 second off from the front of the video. As a constraint, I wanted to avoid re-encoding the videos, as the number of jobs would take far too much time. The .mp4 files went smoothly, each job taking only a few seconds.
However, when trying to accomplish the same thing for the .webm files, I've hit a block. This is command I am running:
ffmpeg -i downloaded_raw_vids/{{vid_hash}}.webm -ss 00:00:01 -map 0 -c copy trimmed_videos/{video_url}.webm
What seems to happen is that no cut or edit happens whatsoever on the .webm files. Now if I change the timestamp to something like
ffmpeg -i downloaded_raw_vids/{{vid_hash}}.webm -ss 00:00:15 -map 0 -c copy trimmed_videos/{video_url}.webm
I end up with a file that has roughly the first 10 seconds cut out, but not the 15 seconds specified.
My understanding is that .webm files can only be cut on keyframes, and the keyframes are too sparse to actually cut around the 1 second mark as desired originally. It does seem like the first keyframe is present around the 10 second mark, which is why the 15 second argument cuts at that point.
Ultimately I am wondering if there is a way to accomplish the 1 second cut, without having to re-encode every .webm file I am working with.
Upvotes: 2
Views: 1028
Reputation: 31160
Ultimately I am wondering if there is a way to accomplish the 1 second cut, without having to re-encode every .webm file I am working with.
No. you can only cut on keyframes otherwise it requires re-encoding. There are no tricks or magic, it is a property of how temporal video compression works.
Upvotes: 2