New video stuff from USA!

Everything that does not fit anywhere else
Post Reply
User avatar
lgillis
Posts: 137
Joined: Mon May 09, 2022 8:40 am

New video stuff from USA!

Post by lgillis »

Hello dear people! While you were busy with torrent, a new video compression method was developed in the USA, they call it "AOMedia Video 1" or AV1 for short.

They unveiled the Alliance for Open Media in September 2015, which is developing the royalty-free video format as an alternative to paid formats like the outdated H.264 and HEVC.

If you have time in the next few years you can take a look at it, maybe the modern nonsense is an alternative to Bluray.

Wish happy sharing!
User avatar
lgillis
Posts: 137
Joined: Mon May 09, 2022 8:40 am

Re: New video stuff from USA!

Post by lgillis »

AV1 ./. HEVC

Code: Select all

  #!/bin/sh

  SVTAV()
  {
      time \
          ffmpeg -i ../Das\ fünfte\ Element\ \(1997\).mkv \
          -ss 0:05:00 -to 0:08:00 \
          -vf crop=1920:800:0:140 \
          -sn -an \
          -c:v libsvtav1 -preset 5 -crf 30 -g 240 -svtav1-params tune=0:film-grain=8 \
          -pix_fmt yuv420p10le \
          libsvtav1_crop_crf25_p5_g240-8KerneMitSMT_v1_mitigationsOff.mkv
  }

  HEVC() {
      time \
          ffmpeg -i ../Das\ fünfte\ Element\ \(1997\).mkv \
          -ss 0:05:00 -to 0:08:00 \
          -vf crop=1920:800:0:140 \
          -sn -an \
          -c:v libx265 -x265-params crf=19 \
          -pix_fmt yuv420p10le \
          x265_crop_crf19_8KerneMitSMT_v1_mitigationsOff.mkv
  }

  # SVTAV
  # HEVC
Explanation. A video (-i) of high image quality is loaded. ffmpeg starts at minute 5 (-ss) and renders until minute 8 (-to). Black bars at the top and bottom, if present, are cut off using video filters (-vf crop). Subtitles and audio tracks are not applied (-sn -an). The video codecs used (-c:v) and their parameters are in one line. Here libsvtav1 is a suggestion of the developers* for a high quality and HEVC is an empirical value for an actual high quality. To avoid ringing, encoding is done in 10bit (-pix_fmt); this costs a little extra time and affects the final size, but we want to watch movies after all, not just store them. The last line is a meaningful filename. Written in a Posix shell script and split into two functions, SVTAV() and HEVC(). They are called by commenting out (# removing) their identifiers below.

,* Presets: https://gitlab.com/AOMediaCodec/SVT-AV1 ... estions.md
,* Using SVT-AV1 within ffmpeg: https://gitlab.com/AOMediaCodec/SVT-AV1 ... /Ffmpeg.md

My questions were:

· Does AMD's SMT accelerate encoding. For this, ffmpeg was run with and without SMT enabled, 6 cores and 6 threads (SMT off) and 6 cores and 12 threads (SMT on), respectively.

· Currently, four AMD CPU vulnerabilities are known and are contained via software. How high is the performance loss due to mitigations.

· How long does the encoding take in total under these conditions, how many frames per second are achieved on average.

· What file sizes are obtained in practice with comparable settings.

In summary, my little experiment has shown:

· The CPU with SMT turned on (6 cores/12 threads) finished faster (based on the three minutes of video):
    · libsvtav1: 7:00,80 / 8:08,17
    · x265:      4:51,44 / 5:23,07

· The differences due to the mitigations in the Linux kernel and micocode is negligible:
    · libsvtav1 mitigations=on: 0.428x / off: 0.43x (speed)
    · libx265 mitigations=on: 240.15s / off: 240.68s (= 17.93 fps)

(The output of HEVC is decidedly clearer :-\ )

· The file sizes, with no discrepancies due to threads or mitigration:
    · libsvtav1:  39.475.428 ( 38Mi)
    · x265:      191.169.985 (182Mi)

The size differences result from the bitrate of the encoders, libsvtav1 gets by with 1754.7kbits/s, x265 requires 8493.29 kb/s. So there is still room for improvement in the settings for libsvtav1.

The qualities achieved are already good, with HEVC delivering impressive results as always in the setting (crf=19). AVI had to be touched up; the picture was razor-sharp in the close-ups, but looked unnatural overall. In the still image, the missing details and very hard transitions between foreground and background were also apparent.

They say AV1 is supposed to compress 30% "better" than HEVC and I took that as the basis for my complicated conversion: I multiplied the x265 crf 19 by 1.3 and came up with about 24.7, so crf 25 ;-) Anyone who has done this before knows that there is no one crf that fits all movies and only trial and error leads to the desired result. Coded with crf 25 looks much better, but the environment is much too bright to commit me. The video track of the whole movie (2:05:35) has a size of 20Gi, libsvtav1 with the mentioned settings comes to 2.3Gi:

Code: Select all

encoder         : Lavc60.3.100 libsvtav1
frame=180676 fps= 11 q=26.0 Lsize= 2449981kB time=02:05:35.69 bitrate=2663.4kbits/s speed=0.47x
video:2449107kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.035705%
178952.65user 490.21system 4:27:20elapsed 1118%CPU (0avgtext+0avgdata 10413992maxresident)k
65229976inputs+4899976outputs (17major+71916455minor)pagefaults 0swaps
E:4:27:20,54 S:490,21s U:178952,66s P:1118% K:0 W:0 J:./encodieren.sh
Post Reply