I used the answer(s) from this questions, however my video is not trimmed.
How to reproduce reproduce:
The Video I am talking about was recorded via the Ubuntu 22.04 record / "Take a Screenshot" application.
You can download a video here: https://sendanywhe.re/YVSW3OPL
The linked video is 23 seconds long; and I use:
ffmpeg -ss 10 -i linux_screencast.webm -c copy -t 10 shorter.webm
The output states:
rame= 24 fps=0.0 q=-1.0 Lsize= 2kB time=00:00:09.14 bitrate= 1.8kbits/s speed=1.25e+05x
However the output is 21 seconds long; in my original problem the length did not change at all.
- Putting a smaller
-ssvalue behind the-ias also recommended produces an empty output for me. - If I remove the
-copyfor re-encoding the shortening works but the video is squeezed to 1/5 of its size (resolution stays the same). The video looks like a 9:16 video squeezed onto the left of a 16:9.
What am I doing wrong? Is the .webm format produced by the Linux Screencast the problem, or something else?
fps=0.0. There may be a solution without re-encoding, but It's difficult to answer without the input video file. You may try adding-fflags +genpts:ffmpeg -fflags +genpts -ss 21 -i input.webm -c copy -t 10 output.webmor maybe-fflags +genpts+igndts(it's probably not going to fix it). Please share the input video file if you can (using Google Drive for example). – Rotem Mar 23 '24 at 21:38-c copy, the video "cut" must start at a keyframe. It's the same case for H.264 and H.265, but in H.264/H.265, FFmpeg marks the first (say 10 frames that supposed to be cut), as frames that should be ignored (be ignored by the player). With VP8 codec, the first frames are not flagged to be ignored (maybe there is no such feature in VP8). – Rotem Mar 28 '24 at 22:42ffprobe -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries frame=pts_time linux_screencast.webmandffmpeg -ss 10 -i linux_screencast.webm -c copy -t 10 shorter.webm. For analysing the packets use:ffprobe -select_streams v -show_packets shorter.webm. The flag of the first packet isflags=K_(keyframe). the other packets flag is empty. The trimming without re-encoding you are trying to perform, is not supported.... You may re-encode the video:ffmpeg -y -ss 10 -i linux_screencast.webm -c:v libvpx -t 10 shorter.webm. – Rotem Mar 28 '24 at 22:45