0

I have a screenrecording of a video chat I had and the filesize is massive because the screen recording itself was done at 59.93 fps. However, I think the video chat was something like 15-30 fps. Plus it was a video chat, so the individual frames were obviously compressed as well.

I don't want to lose the quality of the video (it's already somewhat poor considering it was a vid chat). However, I'd like to reduce the filesize. I don't quite know how to best go about this though... I suppose my question boils down to:

  1. Is there a way to somehow lower the framerate of the video in a way such that it is in sync with the framerate of the vid chat?
  2. Are there any other compression options I have that I'm unaware of?

Here's the ffmpeg -i output if that helps:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\Untitled1.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2015-08-02T20:32:54.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: MacBookAir4,2
    com.apple.quicktime.software: Mac OS X 10.10.4 (14E46)
    com.apple.quicktime.creationdate: 2015-08-02T12:46:10-0700
  Duration: 00:45:19.57, start: 0.000000, bitrate: 12981 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1438x874, 12974 kb/s, SAR 1:1 DAR 719:437, 59.93 fps, 60 tbr, 6k tbn (default)
    Metadata:
      creation_time   : 2015-08-02T20:32:54.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : H.264
  • You could convert it to h265, it is approximately 1/10 the size of a h264 without a notable quality loss – mashuptwice Feb 18 '22 at 04:11
  • From my understanding ffmpeg already "syncs" the framerate, by just dropping individual frames. – mashuptwice Feb 18 '22 at 04:13
  • Use the `mpdecimate` filter (see linked post above) and use H.265 to further reduce the file size. I doubt you can get 10x compression though … – slhck Feb 18 '22 at 08:38

1 Answers1

0

FFMPEG simply drops "unnecessary" frames of the video when using -filter:v fps=n

A detailed explanation can be found here

By additionaly converting the video from h264 to h265 you can compress the video by approximately a factor of up to 10, without a noticeably quality loss. That means a 100MB file would only take up 10MB of space afterwards, without taking the reduced framerate into consideration.

Example:

ffmpeg -i <input> -filter:v fps=30 -c:v libx265 -vtag hvc1 -c:a copy <output> 
mashuptwice
  • 2,929
  • 2
  • 12
  • 25
  • Your answer is not quite correct. In the original screen recording, if it was recorded at ~60 fps, ffmpeg will never drop unnecessary frames when re-encoding. It will keep the frame rate as-is, and the link you added does not apply. If the actual video chat that was recorded had a lower intrinsic frame rate, you have to do signal processing (e.g., via the `mpdecimate` filter) to remove duplicated frames. Also, the compression gains from H.265 over H.264 are not 10x – that would be a bit extreme. The factor is more like 2. – slhck Feb 18 '22 at 08:41
  • Note: When you specify fps=30, it will basically drop every other frame, irrespective of whether that frame was actually relevant in terms of the recorded video conversation. – slhck Feb 18 '22 at 08:42
  • @slhck The factor 10 comes from my own observations from converting a bunch of 25-100GB+ h264 files to h265. It was somewhere in between 7-10, depending on the file, in my case. The link is perfectly relevant as it explains detailed how FFMPEG processes a change in framerate. Note that my example command includes `-filter:v fps=30` and therefore the output framerate **will** be changed, in contrary to your statement. – mashuptwice Feb 18 '22 at 08:58
  • The factor is rather 2, not 7–10. HEVC has a BD-Rate gain of 50% over AVC. This has been shown in various scientific studies (e.g., Guo et al. “Compression performance comparison of x264, x265, libvpx and aomenc (…)” at PCS 2018 or Rerabek et al. “Comparison of compression efficiency between HEVC/H. 265 and VP9 (…)” from SPIE Applications of Digital Image Processing). Also, the OP asked how to “lower the framerate of the video in a way such that it is in sync with the framerate of the vid chat.” — this is not achieved with simply setting `fps=30`. I clarified this in my second comment. – slhck Feb 18 '22 at 10:45
  • My results differ **greatly** from a factor of 2: `╭─user@yoga /some/redacted/directory ╰─$ la redacted total 10.1G -rwxrwxrwx 1 user user 1.2G Feb 15 11:52 redacted-h265.mkv -rwxrwxrwx 1 user user 8.9G Feb 3 15:11 redacted.mkv ╭─user@yoga /some/redacted/directory ╰─$ la redacted2 total 13.8G drwxrwxrwx 2 user user 8 Feb 16 07:01 somedirectory -rwxrwxrwx 1 user user 1.7G Feb 16 11:52 redacted2-h265.mkv -rwxrwxrwx 1 user user 12G Dec 1 22:18 redacted2.mkv` – mashuptwice Feb 18 '22 at 10:58
  • You may not realize that OP also asked "2. Are there any other compression options I have that I'm unaware of?". Thanks for providing the better option for reducing the framerate, but my point stands as is. – mashuptwice Feb 18 '22 at 11:01
  • Of course the resulting file size could be 10x less. One would have to measure the quality of the output and make sure it's the same, either via subjective testing or via accurate video quality models. If you are fine with a noticeable quality loss, then you can compress it 10x. It may very well be that you, personally, do not notice the loss in practice. It strongly depends on the content. Just saying that when correctly measured, a factor of 10x without users noticing quality degradations is not feasible. But I agree that if the user wants to re-encode, they might as well use HEVC. – slhck Feb 18 '22 at 12:18