1

I used the answer(s) from this questions, however my video is not trimmed.

How to reproduce reproduce:

  1. The Video I am talking about was recorded via the Ubuntu 22.04 record / "Take a Screenshot" application.

  2. 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 -ss value behind the -i as also recommended produces an empty output for me.
  • If I remove the -copy for 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?

5
  • I think the issue is related to the PTS timestamps of the input video, since 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.webm or 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 at 21:38
  • @Rotem thank you for you reply. I now shared the video and how I produced the video via the Ubuntu recorder. I tested it with some other webm videos where the cutting worked correctly. I'll now try our your commands.
    – Daraan
    Mar 27 at 10:48
  • Concerning the two additional flags the video still has a length of ~20 seconds.
    – Daraan
    Mar 27 at 10:52
  • It looks like that with VP8 codec, when using codec copy -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 at 22:42
  • Use FFprobe for analysing the timestamps: ffprobe -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries frame=pts_time linux_screencast.webm and ffmpeg -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 is flags=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 at 22:45

1 Answer 1

0

The time is probably wrong because your video has 10 seconds but on the metadata of the video it says it has 30 seconds, so maybe removing the metadata:

ffmpeg -ss 21 -i input.webm -map_metadata -1 -c copy output.webm
1
  • It seems like the original vídeo is missing 2 seconds, it says 22 seconds but it stops after 20... Mar 27 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .