I find it hard to describe the title properly.
I recently purchased an AMD gpu, the latest version. The issue I have is twofold. I am using the latest ffmpeg static build and the latest AMD gpu drivers.
#1. Using ffmpeg I cannot output video with B frames using encoder h264_amf. I understand that AMD only enables them in h264, not hevc yet.
#2. I cannot see any output difference in file size or data rate no matter which preset (-usage) I use. Its as if its only using the default, “Transcoding” ? one even when one of the others is selected.
To test outside of only using ffmpeg directly, I installed the Voukoder add in to Vegas Pro nle. When I selected the different presets, usage, in the Voukoder render template that I had set up, they again only output the same file size and data rate, using h264 encode.
I tested both of these issues with several previous versions of ffmpeg, same results.
+ Reply to Thread
Results 1 to 30 of 40
-
Last edited by JN-; 1st Apr 2023 at 17:57.
-
try this here to get B frames - https://stackoverflow.com/questions/19456745/libavcodec-libx264-do-not-produce-b-frames
-
My assumption is (as you not starting this clearly) that you are trying to use HW encoder - AMD is very poor on supported features and also overall HW encoding quality - as always, update drivers and check AMF capabilities.
-
Thank you both for responding. I am using HW encoding via the new AMD GPU that I mentioned in my original post. The new AMD GPU is installed in my oldish intel 4790k PC. It also has QSV HW encode capability, tested.
Staying with just the B frame issue for now. I am beginning to think that it may simply not be available via the AMD display driver ?
I downloaded "Shutter encoder" (SE) to test the B frames. Although this app doesn't allow explicit selection of B frames as I understand it it enables them by default.
Using SE I rendered out a test file using QSV HW encoding. It had 2 B frames. I rendered out a test file using AMD HW encoding, it had no B frames.
I'm not familiar with OBS, but I'll download it and see if it can output B frames, if not then it may simply not be available in AMD at this point.
"check AMF capabilities" ... In the ffmpeg latest h264 AMD AMF doc ...
-qp_b <int> E..V....... Quantization Parameter for B-Frame (from -1 to 51) (default -1)Last edited by JN-; 1st Apr 2023 at 18:03.
-
I used the settings mentioned in this link ... https://youtu.be/DXL8_Adbob4 to output B frames in local screen recordings using OBS. Not sure where that leaves me, cannot do the same for Shutter Encoder, Voukoder in VP and my own ffmpeg commands.
Maybe its put together properly so far in OBS only. -
Well, accordingly to some bits and pieces i was able to find on net, AMF B frames support was added recently (<1 year) and more than 1 B frame simply don't work. Obviously video encoding is unimportant for AMD... So if your goal is HW encoding with some sane quality then QSV may be your option but... but if you insist on AMF then perhaps as AMD customer you should contact with AMD as a primary source of information...
From my perspective it is quite poor that AMD don't care... NVidia and Intel are way more customer friendly on this.Last edited by pandy; 1st Apr 2023 at 15:52.
-
I agree fully with what you say. With respect to video encoding I did some RQM tests using the new GPU vs previous tests using Nvenc /QSV and there were no surprises, near the bottom of it quality wise. A saving grace of AMD is it tends to be a bit faster. I was curious about the quality of AV1 AMD vs Nvenc, but impossible to test. Previous Nvenc AV1 that I had had access to was done using a source/reference file of FHD 1920 x 1080. When I used the AMD to output AV1 FHD it always outputs 1920 x 1082. Really disappointing. So I cannot complete the testing. AMD outputs 1080 using h264/hevc aok. I'll test a different FHD clip tomorrow and see is it just one clip or all fhd clips that output 1082.
AMD is using AOMedia, might be better if it was using SVT in ffmpeg.
I was testing the B frames output last night using OBS and I could output 1, 2 and 3 B frames, didn't try any further. That's the only app so far that seems to output B frames. As for the -usage/presets, I may have a look some time later and see if they are an option to select in OBS and check out, definitely not working using ffmpeg etc.Last edited by JN-; 1st Apr 2023 at 18:04.
-
x264 is a software encoder. It doesn't use the GPU. The x264 encoder built into ffmpeg definitely supports b-frames. All x264 presets except ultrafast enable b-frames by default.
-
-
ffmpeg help for h264_amf:
Code:ffmpeg -? encoder=h264_amf >help_h264_amf.txt
Code:Encoder h264_amf [AMD AMF H.264 Encoder]: General capabilities: dr1 delay hardware Threading capabilities: none Supported hardware devices: d3d11va d3d11va dxva2 dxva2 Supported pixel formats: nv12 yuv420p d3d11 dxva2_vld h264_amf AVOptions: -usage <int> E..V....... Encoder Usage (from 0 to 3) (default transcoding) transcoding 0 E..V....... Generic Transcoding ultralowlatency 1 E..V....... lowlatency 2 E..V....... webcam 3 E..V....... Webcam -profile <int> E..V....... Profile (from 66 to 257) (default main) main 77 E..V....... high 100 E..V....... constrained_baseline 256 E..V....... constrained_high 257 E..V....... -level <int> E..V....... Profile Level (from 0 to 62) (default auto) auto 0 E..V....... 1.0 10 E..V....... 1.1 11 E..V....... 1.2 12 E..V....... 1.3 13 E..V....... 2.0 20 E..V....... 2.1 21 E..V....... 2.2 22 E..V....... 3.0 30 E..V....... 3.1 31 E..V....... 3.2 32 E..V....... 4.0 40 E..V....... 4.1 41 E..V....... 4.2 42 E..V....... 5.0 50 E..V....... 5.1 51 E..V....... 5.2 52 E..V....... 6.0 60 E..V....... 6.1 61 E..V....... 6.2 62 E..V....... -quality <int> E..V....... Quality Preference (from 0 to 2) (default speed) speed 1 E..V....... Prefer Speed balanced 0 E..V....... Balanced quality 2 E..V....... Prefer Quality -rc <int> E..V....... Rate Control Method (from -1 to 3) (default -1) cqp 0 E..V....... Constant Quantization Parameter cbr 1 E..V....... Constant Bitrate vbr_peak 2 E..V....... Peak Contrained Variable Bitrate vbr_latency 3 E..V....... Latency Constrained Variable Bitrate -enforce_hrd <boolean> E..V....... Enforce HRD (default false) -filler_data <boolean> E..V....... Filler Data Enable (default false) -vbaq <boolean> E..V....... Enable VBAQ (default false) -frame_skipping <boolean> E..V....... Rate Control Based Frame Skip (default false) -qp_i <int> E..V....... Quantization Parameter for I-Frame (from -1 to 51) (default -1) -qp_p <int> E..V....... Quantization Parameter for P-Frame (from -1 to 51) (default -1) -qp_b <int> E..V....... Quantization Parameter for B-Frame (from -1 to 51) (default -1) -preanalysis <boolean> E..V....... Pre-Analysis Mode (default false) -max_au_size <int> E..V....... Maximum Access Unit Size for rate control (in bits) (from 0 to INT_MAX) (default 0) -header_spacing <int> E..V....... Header Insertion Spacing (from -1 to 1000) (default -1) -bf_delta_qp <int> E..V....... B-Picture Delta QP (from -10 to 10) (default 4) -bf_ref <boolean> E..V....... Enable Reference to B-Frames (default true) -bf_ref_delta_qp <int> E..V....... Reference B-Picture Delta QP (from -10 to 10) (default 4) -intra_refresh_mb <int> E..V....... Intra Refresh MBs Number Per Slot in Macroblocks (from 0 to INT_MAX) (default 0) -coder <int> E..V....... Coding Type (from 0 to 2) (default auto) auto 0 E..V....... Automatic cavlc 2 E..V....... Context Adaptive Variable-Length Coding cabac 1 E..V....... Context Adaptive Binary Arithmetic Coding -me_half_pel <boolean> E..V....... Enable ME Half Pixel (default true) -me_quarter_pel <boolean> E..V....... Enable ME Quarter Pixel (default true) -aud <boolean> E..V....... Inserts AU Delimiter NAL unit (default false) -log_to_dbg <boolean> E..V....... Enable AMF logging to debug output (default false)
-
I spent some time with OBS, can definitely confirm using the settings supplied by youtube video mentioned previously, that B frames are available with the AMD encoder set. I used this to output 3 B frames, I tested up to 4 ...
[Attachment 70132 - Click to enlarge]
BReferenceEnable=1 MaxConsecutiveBPictures=3 BPicturesPattern=3.
I can confirm that testing with several different FHD clips that AMD AV1 always outputs 1920 x 1082.
I use -bf:v n to set the 'n' number of B frames using ffmpeg with AMF encoder and it never outputs any B frames. I use this same syntax for Nvenc and QSV HW encoding. I use -x264-params bframes=n and and -x265-params bframes=n with CPU x264/x265 encoding and they all output B frames. I may be missing some required AMD ffmpeg syntax, perhaps its not -bf:v n, I have also tried -bframes n.Last edited by JN-; 2nd Apr 2023 at 12:12.
-
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki
https://codecalamity.com/amd-re-introduces-the-b-frame/
https://github.com/rigaya/VCEEnc
https://codecalamity.com/amd-improves-video-encoding-yet-again-this-time-with-pre-analysis/
So... there is some documentation and also ffmpeg alternatives but to be honest you are alone on this trip.... have no VCE HW in my PC... -
And the car has run out of fuel ! Thanks for the links. I know my limitations, anything on github I find mostly in-penetrable. I'm looking forward to reading the codecalamity stuff later.
I would like to add that, as I expected, the B frames working in OBS appears to be limited to h264, just tested using the previous settings that worked for h264.
I've exhausted my efforts on this for now. As and when updates do appear for ffmpeg and the AMD Adrennlin Display driver I will check the ffmpeg syntax commands again for B frames and the -presets. OBS calls them Latency, the ffmpeg docs -usage. My guess is that these two items #1 #2 may simply not yet be working in ffmpeg.
Thanks all for time and effort in posting. If I do get purchase on this with any of the software updates i'll post here again. Thanks. -
B-frames were only re-enabled about a year ago. Be sure all your drivers and software are up to date.
https://www.tomshardware.com/news/amd-amf-encoder-quality-boost -
You can also try VCEEncC by rigaya. His encoders like NVEncC (for Nvidia) and QSVEncC (for QuickSync) are usually the most feature packed from each SDK, and the most up to date
https://github.com/rigaya/VCEEnc
Last release was 2 days ago
https://github.com/rigaya/VCEEnc/releases
EDIT: oops, didn't see it was already posted aboveLast edited by poisondeathray; 2nd Apr 2023 at 18:19.
-
It's the "VCEEncC_8.11_x64.7z " link
https://github.com/rigaya/VCEEnc/releases/download/8.11/VCEEncC_8.11_x64.7z
I can't test as I don't have current AMD hardware -
You can use VCEEncC64 --help 1>help.txt to print out the instructions
The syntax for all of them (NVEncC, QSVEncC) are basically the same
Usage: VCEEncC [Options] -i <filename> -o <filename>
.
.
.
-b,--bframes <int> set consecutive b frames (default: 0)
A quick check for h264 b-frames encoding
Code:VCEEncC --bframes 3 --codec h264 -i input.ext -o output.ext
-
AOK, thank you. I'll check that out tomorrow evening, it's near bedtime here in Dublin. So as I understand it the AMD encoder is part of VCEEncC64 ?
-
Thanks PDR. In short, the B frames and presets work aok using VCEEncC64.exe. So I don't know why not using ffmpeg. Thats a nice program, putting all of the options like that at the start is simpler too, although maybe there is an order within the options. I had only 2 issues .. I couldn't succeed in outputting a different frame rate and I always got a warning when I enabled B frames, although that did still output B frames. I am going to paste a few notes to that effect below, plus the simple batch file I used to test.
Using VCEEncC64 ..
---------------
B frames ..
--------
When outputing B frames in h264 (max of 3) it works, the B frames are output, but I get 2 red lines at the top ...
storage->StProperty(BPicturesDeltaQP)=6 failed: invalid param..
storage->StProperty(ReferenceBPicturesDeltaQP)=4 failed: invalid param..
See my post number 33 re: The “storage” lines with errors.
B frames have a max of 3 with h264.
B frames work with h264. A warning, not supported in hevc. No warning, none output in AV1.
-----------------------------------------------------------------------------------------
Presets ..
-------
Using h264 .. -preset works. default can be none set or "balanced", "fast", "slow". All 3 output different data rate and file sizes, so aok.
Using AV1 .. 4 presets .. balanced, fast, slow, slower
AV1 -preset works but default i.e. none set = balanced outputs the same file size and data rate as 'fast'.
-------------------------------------------------------------------------------------------------------------------
I cannot enable a frame rate change. Source is 29.97 fps. If I enter say --fps 25 I get a yellow warning ...
avvce/avsw: Unknown input option: framerate=25/1, ignored.
This is in the help file .. --fps <int>/<int> or <float> set framerate
I tried ..
--fps 25
--fps 25/1
--fps 25.0
--fps 23.976 I get message .. avvce/avsw: Unknown input option: framerate=24000/1001, ignored.
--fps 24000/1001 I get message .. avvce/avsw: Unknown input option: framerate=24000/1001, ignored.
Batch file ...
@echo off
Setlocal EnableDelayedExpansion
Color 0A
if "%1"=="" goto HELP
REM VCEEncC64 --codec av1 --cqp 20 --profile main --preset fast --gop-len 50 --audio-copy -i "%1" -o "4s-bray-output-1.mp4"
VCEEncC64 --codec h264 --fps 25 --cqp 20 --profile main --preset fast --bframes 2 --gop-len 50 --audio-copy -i "%1" -o "4s-bray-output-1.mp4"
REM h264 --Profile can be only Baseline, Main, High
REM hevc --Profile can be only Main, Main10
REM AV1 --Profile can be only main
REM -u,--preset <string> set quality preset
REM balanced is default if none entered, fast, slow, (slower is for AV1 only)
echo.
pause
exit
:HELP
echo.
echo.
echo Use drag and drop ...
echo.
echo Press any key ...
echo.
echo.
pause>nul
color
exitLast edited by JN-; 5th Apr 2023 at 06:48.
-
When outputing B frames in h264 (max of 3) it works, the B frames are output, but I get 2 red lines at the top ...
2 red lines on only b-frames ? or 2 red lines on every frame ?
What about when using no b-frames ? Do the red lines occur ? Did you check other player to rule out decoding issue ?
What were the characteristics of the source ? progressive/interlaced ? dimensions ? pixel type ?
I cannot enable a frame rate change.
How did you want to change the framerate ? What method ? Dropping frames ? blending frames ? 29.97 to 25 is usually problematic - are you sure the "29.97" is not telecined and actually 23.976 ?
Depending on your choice you might have to adjust the audio and resample too. Way too many permutations and complexities for using --fps if you want to do it properly -
"2 red lines on only b-frames ? or 2 red lines on every frame ?"
I may not have been clear enough, the 2 red output text lines are the VCEEncC64.exe's on screen output. The encoded output file plays and looks fine.
[Attachment 70151 - Click to enlarge]
"How did you want to change the framerate ?" Why ? Simply to see if I could use that util VCEEncC64.exe to do the things that I am used to doing with ffmpeg, nothing of value. So I found that I couldn't set a different frame rate, I can use -r in ffmpeg to do that. I have no wish to go further at this time with avisynth/vapoursynth. I was only experimenting. -
B-frames but the same quantizer for I, P and B frames. Not very good for compression.
-
Last edited by JN-; 4th Apr 2023 at 02:49.
-
I don't know how well the VCE encoder deals with them but with a quantizer of 20 for I frames, try 22 for P frames, 24 for B frames. The idea is that you won't notice lower quality for a few B frames because a new P or I frame will clean it up again. This is where most of the additional compression comes from when using B frames.
The red error messages you're getting may indicate that those commands aren't working though. -
I'm not at all familiar with VCEEncC64, this is my 1st. use. It served a purpose of confirming that B frames and presets are supported in output. So I cannot sort out/fix the error messages, any more than I cannot enable setting a frame rate.
I still have no idea why the B frames and presets don't work with ffmpeg.
Anyway, that's very useful info and I will use that quantizer method within ffmpeg with AMD and also if applicable to QSV and Nvenc. Up to now I had simply used the same quantizer amount for IBP.
"The red error messages you're getting may indicate that those commands aren't working though."
"I don't know how well the VCE encoder deals with them" If I was able to remove the error messages then I could do some RQM testing with the quantizer settings.
I am already happy with what I have achieved and confirmed thanks to all of the contributors here. For example I have never used OBS before and when I enabled hevc output I found that there was a problem (I use ffprobe in my util) in extracting some frames, they were not IBP. I think just an error message, failure to extract ? ... [hevc @ 0000024bbf1d1c00] VPS 0 does not exist. Also [hevc @ 000001db08fd8000] SPS 0 does not exist.
I have worked around this but if I hadn't used OBS with hevc I wouldn't have known about this. It could arise in the future with some other output and so I am now prepared! Progress of sorts.Last edited by JN-; 4th Apr 2023 at 10:32.
-
The error message "SetProperty(BPictureDeltaQP)=6 failed" sound like an attempt to set the QP for B frames 6 higher than the QP for I frames.
My guess is that AMD neglected the hardware encoder for so long that the ffmpeg developers stopped maintaining it. And any that still deal with it are concentrating on its HEVC encoder.
Others usually default to different quantizers for the different frame types. For example, from an random x264 log:
Code:x264 [info]: frame I:11 Avg QP:17.27 size:119144 x264 [info]: frame P:134 Avg QP:19.54 size: 11355 x264 [info]: frame B:356 Avg QP:20.34 size: 5199
-
"The error message "SetProperty(BPictureDeltaQP)=6 failed" sound like an attempt to set the QP for B frames 6 higher than the QP for I frames."
I'll have a look again at that later, there's a new Amd Adrenlin update, will install that later.
RE: ffmpeg, I saw a comment by a guy on Tom's Hardware who did a big rqm test, Amd and the usual suspects, he indicated that ffmpeg were working with Amd on improving things ? Out and about now, I'll update with link later. https://www.tomshardware.com/news/amd-intel-nvidia-video-encoding-performance-quality-testedLast edited by JN-; 4th Apr 2023 at 18:27.
Similar Threads
-
Issue with h264 deinterlace in Avisynth
By mrwhitethc in forum Video ConversionReplies: 5Last Post: 14th Nov 2021, 10:50 -
get-iplayer & youtube-dl issue from BBC TOTP (frames out of correct order)
By fbr$ in forum Video Streaming DownloadingReplies: 0Last Post: 20th Mar 2021, 17:21 -
Fixing unmarked interlaced frames in h264 stream without re-encoding
By hedgehog90 in forum Newbie / General discussionsReplies: 9Last Post: 5th Jan 2021, 12:54 -
Duplicate frames issue
By tupper in forum Video ConversionReplies: 1Last Post: 18th Dec 2019, 11:04 -
Importing presets to Vidcoder 4.36
By carlmart in forum Video ConversionReplies: 0Last Post: 23rd Aug 2019, 20:56