Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
8th May 2019, 08:27 | #1 | Link |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
x265 not honoring slice config
hi, im trying to encode some hevc files for use in an ABR stack where the config is:
4 sec GOP IDR at the start on each GOP I-frames on scenecut Syntax: Code:
./ffmpeg -loglevel verbose -i test.mov -codec:v libx265 -x265-params keyint=100:min-keyint=100:no-open-gop=1:nal-hrd=VBR:force-cfr -preset fast -crf 23 -maxrate 15M -bufsize 15M -force_key_frames "expr:eq(mod(n,100),0)" -c:a:0 aac -ac:a:0 2 -ab:a:0 128k -y hevc.mp4 Code:
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00 Harmonic's AV analyzer tells me that x265 is actually encoding IDRs as CRA slices instead.. with some Iframes mixed in here an there.. in X264, this is all correct, but x265 this fails.. Anyone have any idea whats going on here? Last edited by TEB; 8th May 2019 at 11:34. |
9th May 2019, 05:44 | #2 | Link |
Derek Prestegard IRL
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
|
-force_key_frames "expr:eq(mod(n,100),0)"
don't use this. It's a BAD idea. Just set keyint equal to min-keyint Also, your x265-params is likely not being parsed because you have force-cfr, which isn't a thing for x265. Fix those two things and you should get correct keyframe config. |
9th May 2019, 10:44 | #3 | Link | ||
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Quote:
Ok, ive done this now and removed the rest Quote:
Fix those two things and you should get correct keyframe config. Ok. Updated "clean" x265 config: Code:
./ffmpeg -loglevel verbose -i test.mov -codec:v libx265 -x265-params keyint=100:min-keyint=100:no-open-gop=1:nal-hrd=VBR -preset slow -crf 23 -maxrate 5M -bufsize 5M -c:a:0 aac -ac:a:0 2 -ab:a:0 128k -y test.mp4 Now atleast X265 is behaving from a syntax level : Code:
x265 [info]: Keyframe min / max / scenecut / bias: 100 / 100 / 40 / 5.00 1. It starts of with an IDR frame, but then its all over.. 2. At frame 100, there should be an IDR, but thats a B frame.. 3. All scenecut iframes are CRA frames not regular I-frames.. 4. And at frame 100,200,300,400, etc there should be an IDR.. Any idea whats going on ? TEB Last edited by TEB; 9th May 2019 at 10:52. |
||
9th May 2019, 12:37 | #4 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 324
|
Quote:
Your syntax should work, according to the .log file x265 creates I get an I-frame every 100 frame with --keyint 100 --min-keyint 100 --no-open-gop (At least I think "I" with a captial letter is IDR frames), and scenecuts get an "i". What is the "nal-hrd" command? Cant find it in the x265 documentation. Last edited by excellentswordfight; 9th May 2019 at 12:41. |
|
9th May 2019, 19:07 | #5 | Link |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
I must admit my knowledge at the frame level in HEVC is somewhat lacking. So please excuse my ignorance but in my understanding there are 4 types of I-frames in HEVC:
IDR, CRA, BLA and normal I-frames.. Well thats what Harmonics AV Analyser is saying.. ffprobe´s parse just say capital I and non- capital I. IDR is the only one that actually enforces a full flush of the decoders buffer, hence beeing used in a ABR ladders cross points. The main problem here is that Shaka Packager is getting the segment length wrong due to this as it expects an IDR frame at the start of every segment |
9th May 2019, 19:51 | #6 | Link |
Derek Prestegard IRL
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,989
|
Hm... that's odd.
I'd expect frame 100 to be an IDR for sure. I use very similar GOP config for ABR just fine - admittedly with a different packager. You could try disabling scenecut, but it should still work without that. |
9th May 2019, 20:13 | #7 | Link |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Well.. from my perspective theres multiple bugs here in x265.. cannot explain more than that..
In x264, it all works fine, with IDR at every GOP start and Iframes "inside" the gop on scenecut Packagers work good with the bitstreams also.. |
10th May 2019, 08:07 | #8 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 324
|
Quote:
How is it behaving if you're piping it to and standalone x265 executable? Last edited by excellentswordfight; 10th May 2019 at 08:27. |
|
10th May 2019, 15:34 | #9 | Link | |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Quote:
I can try to disable Open-gop, but i really cant use open-gop in a ABR domain.. I was just thinking about trying x265 standalone with piping yes.. |
|
10th May 2019, 18:48 | #11 | Link | |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Quote:
So, its a long time since ive tried piping from ffmpeg to x265, but i cannot the world get it to work now: Code:
ffmpeg -i "output.mov" -strict -1 -vf format=yuv420p10 -f yuv4mpegpipe - | "x265.exe" --y4m - --output-depth 10 --input-res 1920x1080 --fps 25 --preset slow --no-open-gop --keyint 100 --min-keyint 100 --profile main10 --sar 1:1 --vbv-bufsize 15000 --crf 19 --vbv-maxrate 15000 -y test.mp4 Code:
yuv4mpegpipe @ 00000207a4021140] Warning: generating non standard YUV stream. Mjpegtools will not work. Code:
av_interleaved_write_frame(): Invalid argument Error writing trailer of pipe:: Invalid argument |
|
11th May 2019, 07:54 | #14 | Link |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Good news! It works as intended by using ffmpeg pipe to x265!
Every 4 sec, IDR, and normal I-frames inbetween on scenecut Besides 2 errors repported by AV Analyser most seem fine. Code:
Error Buffer Analysis Missing parameter 0 0 Info appearance: Picture Timing SEI message not found, NAL index [0]. SPS Id [0] Error Buffer Analysis Missing parameter 0 0 Info appearance: Buffering Period SEI message not found, NAL index [0]. SPS Id [0] Code:
ffmpeg -i "output.mov" -strict -1 -vf format=yuv420p10 -f yuv4mpegpipe - | "x265.exe" --y4m - --output-depth 10 --input-res 1920x1080 --fps 25 --preset fast --no-open-gop --keyint 100 --min-keyint 100 --profile main10 --sar 1:1 --vbv-bufsize 15000 --crf 19 --vbv-maxrate 15000 -o test2.hevc Code:
y4m [info]: 1920x1080 fps 25000/1000 i420p10 sar 1:1 unknown frame count raw [info]: output file: AiB_GOT_test2.hevc x265 [info]: HEVC encoder version 3.0_Au+22-feec4bdf9866 x265 [info]: build info [Windows][GCC 6.3.0][64 bit] 10bit x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 x265 [info]: Main 10 profile, Level-4 (High tier) x265 [info]: Thread pool created using 16 threads x265 [info]: Slices : 1 x265 [info]: frame threads / pool features : 4 / wpp(17 rows) x265 [info]: Coding QT: max CU size, min CU size : 64 / 8 x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2 x265 [info]: Keyframe min / max / scenecut / bias: 100 / 100 / 40 / 5.00 x265 [info]: Lookahead / bframes / badapt : 15 / 4 / 0 x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0 x265 [info]: References / ref-limit cu / depth : 3 / on / on x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1 x265 [info]: Rate Control / qCompress : CRF-19.0 / 0.60 x265 [info]: VBV/HRD buffer / max-rate / init : 15000 / 15000 / 0.900 x265 [info]: tools: rd=2 psy-rd=2.00 rskip signhide tmvp fast-intra x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao *preset = slow *Any tips on reducing banding in dark scenes? Please note that i have a 10bit source and using main10 outbound.. PS! Thx for all the help! /TEB Last edited by TEB; 11th May 2019 at 08:08. |
12th May 2019, 14:26 | #15 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,730
|
You could try aq-mode 3 to boost the dark areas. The bitrate will be a lot higher though. And add --no-sao to keep more details intact.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
15th May 2019, 20:17 | #17 | Link | |
Registered User
Join Date: Feb 2003
Location: Palmcoast of Norway
Posts: 363
|
Quote:
Ive been using min-keyint with x264 (maybe it just ignores it ) and no-scenecut basically disables auto-iframe insertion.. Im doing the opposite since we have 4 sec segments.. Any reason why u turn it off? UPDATE: I did 3 tests and analysed them all with Harmonics AV Analyser: 1. x265 --keyint 100 --no-scenecut = Gives an IDR pr 4 sec as expected, but no Iframes inside the GOP on scenechange 2. x265 --keyint 100 = Gives an IDR pr 4 sec as expected, but keyframes between the 4 sec boundries formatted as IDR (mostly) and some I frames on scenechange 3. x265 --keyint 100 --min-keyint 100 = Gives an IDR pr 4 sec as expected, and keyframes formatted as regular I-frames dynamically inserted on scenechange Last edited by TEB; 16th May 2019 at 09:53. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|