SVT-VP9 icon indicating copy to clipboard operation
SVT-VP9 copied to clipboard

Low quality video as the result of encoding

Open casperr0 opened this issue 3 years ago • 1 comments

Hello! I'm having some problems with encoding videos

Parameters:

Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz 16 cores RAM 14 gb

Software: GCC: 7.5.0 CMake: 3.10.2 YASM: Assembler version 1.3.0 OS: Ubuntu 18.04.4 LTS (Bionic Beaver)

I wanted to encode an mp4 video Used following commands:

$ffmpeg -i my_video.mp4 -an -c copy -y in.yuv

$./SVT-VP9/Bin/Release/SvtVp9EncApp -w 1280 -h 720 -i in.yuv -fps 25 -rc 1 -tbr 7000000 -vbv-maxrate 7000000 -vbv-bufsize 14000000 -intra-period 100 -asm 0 -b out.ivf

Output:

SVT [version] : SVT-VP9 Encoder Lib v0.3.0 SVT [build] : GCC 7.5.0 64 bit LIB Build date: Jan 25 2022 09:48:56

[WARNING] For best speed performance, run with sudo privileges !

Number of logical cores available: 16 Number of PPCS 31

SVT [config]: Profile [0] Level (auto) SVT [config]: EncoderMode / Tune : 9 / 1 SVT [config]: EncoderBitDepth : 8 SVT [config]: SourceWidth / SourceHeight : 1280 / 720 SVT [config]: FrameRate / Gop Size : 25 / 101 SVT [config]: HierarchicalLevels / BaseLayerSwitchMode / PredStructure : 3 / 0 / 2 SVT [config]: RCMode / TargetBitrate : VBR / 7000000

Encoding 55 SUMMARY --------------------------------- Channel 1 -------------------------------- Total Frames Frame Rate Byte Count Bitrate 55 25.00 fps 10871312 39532.04 kbps

Channel 1 Average Speed: 11.10 fps Total Encoding Time: 4954 ms Total Execution Time: 5277 ms Average Latency: 4004 ms Max Latency: 4883 ms Encoder finished

Then I'm encoding it to mp4

$ffmpeg -i out.ivf -c copy rrr.mp4 -y

Output: Input #0, ivf, from 'out.ivf': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: vp9 (Profile 0) (VP90 / 0x30395056), yuv420p(tv), 1280x720, 25 tbr, 25 tbn, 25 tbc Output #0, mp4, to 'rrr.mp4': Metadata: encoder : Lavf58.76.100 Stream #0:0: Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv), 1280x720, q=2-31, 25 tbr, 12800 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 1 fps=0.0 q=-1.0 size= 1024kB time=00:00:00.00 bitratframe= 103 fps=0.0 q=-1.0 Lsize= 10618kB time=00:00:02.16 bitrate=40267.7kbits/s speed=41.3x
video:10617kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.012446%

The resulting video is shorter than the input video and the whole output video is TV-noises I also tried the following encoding parameters and got the same result:

$SvtVp9EncApp -w 1280 -h 720 -i in.yuv -n 0 -asm 0 -fps 25 -b out.ivf
$SvtVp9EncApp -w 1280 -h 720 -enc-mode 8 -tune 0 -i in.yuv -fps 25 -rc 1 -tbr 7000000 -asm 0 -b out.ivf

I tried to run it with a few mp4 videos of different input width and hight and always get the same output

If I run with “-asm 1” I get Illegal instruction error If I run with -w 1920 -h 1080 (the input video is 1920*1080) then I get Segmentation fault. But if I run with -w 1280 -h 720 it doesn’t get this error.

Could you please advise me where to look in order to fix this?

casperr0 avatar Jan 25 '22 07:01 casperr0

Hi @casperr0 , I did some quick test, using the same command,

  1. I didn't see any quality issue in 720p image

  2. 1080p no seg fault image

Xeon E5 supports up to AVX. -asm 1 will run the AVX2 implementation, hence the Illegal instruction.

Some suggestions for further step:

  1. Use ffmpeg patch directly if your pipeline integrates ffmpeg instead of SvtVp9EncApp
  2. Upgrade GCC to GCC-10. https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version

tianjunwork avatar Jan 25 '22 17:01 tianjunwork