Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbr and vbr always uses 20mbit for hevc #1

Open
Selur opened this issue Feb 8, 2017 · 14 comments

Comments

@Selur
Copy link

commented Feb 8, 2017

When using --vbr or --cbr the output bit rate seems to be always 20000.
I first thought that was because I set the max-bitrate to 20000, but even when using cbr&maxbitrate 1500 the resulting file had a bit rate of 20000.

@rigaya

This comment has been minimized.

Copy link
Owner

commented Feb 10, 2017

Thank you for the report.

I also recognize this problem, but it is being difficult to figure out what is the problem, whether it is problem of my coding or it is current behavior of AMF/driver.

It seems that the clean-up of AMF is going on. I'll wait for the next version of AMF to come up, and then start checking this issue.

@Xaymar

This comment has been minimized.

Copy link

commented Feb 12, 2017

The problem is with Filler Data and Enforce HRD. Disable both and it should start working.

Edit: I have reported this to AMD: GPUOpen-LibrariesAndSDKs/AMF#73

@rigaya

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2017

Thank you for the information. I'll add options to enable/disable filler data & hrd.

rigaya added a commit that referenced this issue Feb 14, 2017
hrdを設定するオプションを追加。(--enforce-hrd)
こちら( GPUOpen-LibrariesAndSDKs/AMF#73 / #1 )に報告のあったように、
現状のAMFではこのオプションを使用するとHEVCエンコード時にレート制御が不安定になることから、
デフォルトではオフとする。
@rigaya

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2017

I have disabled Enforce HRD by default, but still it seems that the bitrate will not go to the target bitrate. I cannot tell this is the problem of my app, or the behavior of AMF.

@Selur

This comment has been minimized.

Copy link
Author

commented Feb 14, 2017

not sure, but: the crucial part is probably disabling filler data otherwise the encoder will probably always fill the bit rate up till it hits the max bit rate.

@Xaymar

This comment has been minimized.

Copy link

commented Feb 14, 2017

I can take a look if you can point me at the file that determines what is set when.

@Selur

This comment has been minimized.

Copy link
Author

commented Feb 15, 2017

New version doesn't fix the issue.

ffmpeg -y -threads 8 -r 50 -analyzeduration 100M -probesize 100M -i "C:\Users\Selur\Desktop\Test.ts" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f yuv4mpegpipe - | VCEEncC --y4m -i - --codec h265 --cbr 1500 --max-bitrate 1500 --quality balanced --motion-est q-pel --fps 50.000 --profile main --level auto --tier main --sar 1:1 --output-file "H:\Temp\Test_15_06_11_8910_01.265"

I still end up with a constant 20MBit output,...
Uploaded the source file to: https://drive.google.com/drive/folders/0B_WxUS1XGCPAUTlILW54VThMTFU?usp=sharing

Using a low resolution source the bit rate is lower, but the bitrate is totally ignored using different values 100/15000/200/500 all produce the same sized output.
-> seems like the encoder now always uses cq since only the resolution seems to affect the output size,...

@Xaymar

This comment has been minimized.

Copy link

commented Feb 15, 2017

//m_Params.SetParam(AMF_PARAM_FILLER_DATA_ENABLE(prm->nCodecId), false);

Filler Data seems to not default to off as far as i can see, so CBR will produce broken output. you can try and see if driver 17.2.1 fixes the issue.

@Selur

This comment has been minimized.

Copy link
Author

commented Feb 15, 2017

Updated to 17.2.1 (restarted system), but sadly:
ffmpeg -y -threads 8 -r 50 -analyzeduration 100M -probesize 100M -i "C:\Users\Selur\Desktop\Test.ts" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f yuv4mpegpipe - | VCEEncC --y4m -i - --codec h265 --cbr 1500 --max-bitrate 1500 --quality balanced --motion-est q-pel --fps 50.000 --profile main --level auto --tier main --sar 1:1 --output-file "H:\Temp\Test_16_17_00_0310_02.265"
still produces a constant 20MBit output (same when using --vbr)

@rigaya

This comment has been minimized.

Copy link
Owner

commented Feb 16, 2017

Filler Data is set by --filler option now, and default is set off.

setting default
https://github.com/rigaya/VCEEnc/blob/master/VCECore/VCEParam.cpp#L81

setting param

m_Params.SetParam(AMF_PARAM_FILLER_DATA_ENABLE(prm->nCodecId), prm->bFiller != 0);

I have tested 17.2.1 driver, but ended up getting constant 20MBit output with HEVC VBR & CBR mode, same as Selur.

I also notice getting warning from AMF

storage->SetProperty(HevcFillerDataEnable) failed Error:AMF_FAIL

which I didn't get with 17.1.1 driver. So, filler data might be not working with 17.2.1?

@Xaymar

This comment has been minimized.

Copy link

commented Feb 16, 2017

You are correct, 17.2.1 breaks that parameter - hopefully only temporarily.

22:22:19.266: [AMF] <Id: 13> <Plugin::AMD::EncoderH265::SetFillerDataEnabled> Failed to set to Disabled, error AMF_FAIL (code 1)
22:22:19.267: [AMF Runtime] [22:22:19.238][ConvertToDriver]    Error: ..\..\..\..\..\runtime\src\components\EncoderHEVC\DriverParameterAdapter.cpp(382):parameter vector type(2): is not matched
22:22:19.267: [AMF Runtime] [22:22:19.238][DriverParameterAdapter]    Error: ..\..\..\..\..\runtime\src\components\EncoderHEVC\DriverParameterAdapter.cpp(623):AMF_ERROR 1 : AMF_FAIL: Failed to set param. AHEVC err 0x80000002
22:22:19.267: [AMF Runtime] [22:22:19.241][AMFEncoderHEVC]    Error: ..\..\..\..\..\runtime\src\components\EncoderHEVC\EncoderHEVCImpl.cpp(1084):AMF_ERROR 1 : AMF_FAIL: Failed to set param. AHEVC err 0x80000002
22:22:19.267: [AMF Runtime] [22:22:19.241][AMFEncoderHEVC]    Error: ..\..\..\..\..\runtime\src\components\EncoderHEVC\EncoderHEVCImpl.cpp(1084):AMF_ERROR 1 : AMF_FAIL: Failed to set param. AHEVC err 0x80000002
22:22:19.268: [AMF Runtime] [22:22:19.241][AMFEncoderHEVC]    Error: ..\..\..\..\..\runtime\src\components\EncoderHEVC\EncoderHEVCImpl.cpp(784):AMF_ERROR 1 : AMF_FAIL: etProperty HevcFillerDataEnable failed in - SetParameter() failed
@Xaymar

This comment has been minimized.

Copy link

commented Feb 28, 2017

Found the solution, HevcFillerData is a static (pre-Init()) property now.

@Selur

This comment has been minimized.

Copy link
Author

commented Feb 28, 2017

Good to hear looking forward for the next release to test. :)

@Xaymar

This comment has been minimized.

Copy link

commented Apr 5, 2017

@rigaya The proper fix for this has now been found, see GPUOpen-LibrariesAndSDKs/AMF#80. Basically CBR also requires Peak Bitrate for Filler Data to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.