- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
We have a problem. We need to set a custom bitrate using qsv and ffmpeg..
But the SDK forces the bitrate to the minimal value, even if we set BitrateLimit = MFX_CODINGOPTION_OFF as per the other forum posts:
https://software.intel.com/en-us/forums/intel-media-sdk/topic/404650 and other posts.
We set Birate equal to 100kbps before the initialization. Further, we write the part of structures after they are filled by MediaSdk(after the call of MFXVideoDECODE_Init)
We use ffmpeg 4.1 in the project. Mae be, we need to set some additional options? Can you help us?
We need to be able to override the minimum bitratre enforced by qsv to set our own forced bitrate. We have tried with CBR and VBR but it is not working like its supposed to. See below.
mfxExtCodingOption2
mfxExtBuffer Header;
mfxU16 IntRefType = 0
mfxU16 IntRefCycleSize = 0
mfxI16 IntRefQPDelta = 0
mfxU32 MaxFrameSize = 345600
mfxU32 MaxSliceSize = 0
mfxU16 BitrateLimit = 32
mfxU16 MBBRC = 32
mfxU16 ExtBRC = 32
mfxU16 LookAheadDepth = 0
mfxU16 Trellis = 0
mfxU16 RepeatPPS = 16
mfxU16 BRefType = 1
mfxU16 AdaptiveI = 32
mfxU16 AdaptiveB = 32
mfxU16 LookAheadDS = 2
mfxU16 NumMbPerSlice = 0
mfxU16 SkipFrame = 0
mfxU8 MinQPI = 0
mfxU8 MaxQPI = 0
mfxU8 MinQPP = 0
mfxU8 MaxQPP = 0
mfxU8 MinQPB = 0
mfxU8 MaxQPB = 0
mfxU16 FixedFrameRate = 16
mfxU16 DisableDeblockingIdc = 0
mfxU16 DisableVUI = 32
mfxU16 BufferingPeriodSEI = 0
mfxU16 EnableMAD = 0
mfxU16 UseRawRef = 32
mfxInfoMFX;
mfxU32 reserved[7];
mfxU16 LowPower = 32
mfxU16 BRCParamMultiplier = 1
mfxFrameInfo FrameInfo;
mfxU32 CodecId = 541283905
mfxU16 CodecProfile = 100
mfxU16 CodecLevel = 31
mfxU16 NumThread = 0
struct {
mfxU16 TargetUsage = 4
mfxU16 GopPicSize = 12
mfxU16 GopRefDist = 3
mfxU16 GopOptFlag = 1
mfxU16 IdrInterval = 0
mfxU16 RateControlMethod = 1
union {
mfxU16 InitialDelayInKB = 47
mfxU16 QPI = 47
mfxU16 Accuracy = 47
};
mfxU16 BufferSizeInKB = 94
union {
mfxU16 TargetKbps = 378
mfxU16 QPP = 378
mfxU16 ICQQuality = 378
};
union {
mfxU16 MaxKbps = 378
mfxU16 QPB = 378
mfxU16 Convergence = 378
};
......
};
- Tags:
- Development Tools
- Graphics
- Intel® Media SDK
- Intel® Media Server Studio
- Media Processing
- Optimization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, is anyone else able to replicate this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mann,
Apologized for late response.
Which BRC mode are you using, Could you give me more details?
In general, I would suggest you to use our sample code to begin the investigation. FFmpeg QSV plugin uses Media SDK but it might not use its full capability. Using our samples could get the direct answer, then you could apply the result to FFmpeg/QSV.
I suggested sample_multi_transcode or sample_encode, the sample can be find either in the release package or in GitHub below:
https://github.com/intel-media-sdk/mediasdk
For a quick check of sample usage, you can look at following online document:
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-encode_linux.md
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-multi-transcode_linux.md
Although the document is for Linux, it should be the same as Windows.
Let me know if this helps.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mark,
thanks for your reply. I guess the easiest way is for you to see if you can replicate it. For example if we use the formula for min bitrate as defined in the other posts with the 500x max compression, you will see on windows you cannot set a bitrate lower than this amount. That is the whole purpose of the parameter for setting mfxExtCodingOption2.BitrateLimit parameter to "OFF" , to allow us to set a bitrate lower than the automatic limit.
This is the case in both VBR and CBR in ffmpeg (when setting bitrate = to maxrate or not equal). Can you confirm if there is a way to make this work so we can set a bitrate lower than this limit? Is it possible for you to replicate?
Thanks!
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Josh,
Somehow this post was slip away from my attention, really apologized for the late response.
We could reproduce this issue locally.
The root cause is that the q->param.ExtParam with BitrateLimit parameter is not set in time, thus the targetKbps is set to minTargetKbps by default even if bitrate_limit is set to a low value.
Patch works for me (based on ffmpeg-4.2, but should be similar in ffmpeg-4.1):
https://github.com/intel-media-ci/ffmpeg/pull/115
1080P AVC encoding with option "-bitrate_limit 0 -b:v 100k":
Before patch:
902 kbps
After patch:
156 kbps
Could you do a check to see if this solves your problem.
Mark

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page