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

Playback Issues on Nvidia Shield TV and LG OLED65B7A TV #46

Open
krische opened this issue Apr 25, 2018 · 13 comments
Open

Playback Issues on Nvidia Shield TV and LG OLED65B7A TV #46

krische opened this issue Apr 25, 2018 · 13 comments

Comments

@krische
Copy link

krische commented Apr 25, 2018

I'm using the following command to re-encode 4k HDR Blu-ray Remux videos to a lower bitrate:

NVEncC64.exe -c hevc -i "Harry Potter and the Philosopher's Stone (2001).mkv" -o "Harry Potter and the Philosopher's Stone (2001).nvenc.mkv" --avsw --vbrhq 17000 --output-depth 10 --vbr-quality 15 --lookahead 32 --level 5.1 --profile main10 --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --max-cll 552,190 --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(39999999,50) --audio-copy --sub-copy

When I attempt to playback the output of this using a Nvidia Shield TV on a LG OLED65B7A TV, I have issues.

  • If I use Plex, at about 5 to 7 seconds into the video, the playback appears to pause on a frame for around 0.1 seconds then continue. This very brief pause repeats every 2 to 3 seconds.
  • If I use Kodi, at the same 5 to 7 seconds into the video, the TV drops out of HDR mode.
  • I have both apps set to adjust the display refresh rate to match that of the video frame rate.

I am able to produce a video with ffmpeg and libx265 without any playback issues using the following command:

ffmpeg.exe -i "Harry Potter and the Philosopher's Stone (2001).mkv" -c:a copy -c:s copy -c:v libx265 -preset slower -crf 19 -pix_fmt yuv420p10le -x265-params "level-idc=5.1:profile=main10:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(39999999,50):max-cll=552,190:aq-mode=3" -y "Harry Potter and the Philosopher's Stone (2001).ffmpeg.mkv"

My suspicion is that this has something to do with the HDR metadata on the output video.

I've noticed that if I playback the NVEnc video in VLC player, the HDR metadata does not appear in the "Tools > Codec information" dialog until 5 to 7 seconds into the video; at the exact point that Plex and Kodi have issues. Whereas with the FFMPEG produced video, the HDR metadata appears immediately.

I can provide some sample video files if they would assist in analysis.

@rigaya
Copy link
Owner

rigaya commented Apr 26, 2018

Thank you for reporting.

Unfortunately, I don't have HDR TVs, but I was able to reproduce the "delay" in VLC.

What is weird is that the "delay" seems to occur when muxing to mkv, but does not occur when muxing to mp4.

I'll try to check around mkv muxing, and maybe I'll need to update libavformat dlls, as it is nearly a year old (but will take time).

@rigaya
Copy link
Owner

rigaya commented May 2, 2018

I've improved handling of HDR metadatas in NVEnc 4.00, now I see no delay of metadata info showing up in VLC.

I hope this fixes the problem on TV too.

@krische
Copy link
Author

krische commented May 3, 2018

I tried using NVEnc 4.00 with the pre-built Windows binaries on your Google Drive, but it's crashing for me. I tried outputting to both mkv and mp4 container, and it crashes with both. If I run it with --log-level trace I receive the following output:

NVEncC64.exe -c hevc -i "The Dark Knight Rises (2012).mkv" -o "The Dark Knight Rises (2012).nvenc.mp4" --vbrhq 17000 --output-depth 10 --vbr-quality 15 --lookahead 32 --level 5.1 --profile main10 --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --max-cll 500,200 --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(39999999,50) --audio-copy --log-level trace
Loaded nvEncodeAPI64.dll.
GPUAutoSelect: Success.
avhw reader selected.
InitInput: input selected : 8.
avsw: select audio track all, codec copy
avsw: opened file "The Dark Knight Rises (2012).mkv".
avsw: got stream information.
avsw: found video stream, stream idx 0
avsw: found audio stream, stream idx 1, trackID 1.0, dts, frame_size 0, timebase 1/1000
avsw: use video stream #0 for input, codec hevc, stream time_base 1/1000, codec_timebase 1001/24000.
avsw: set log_level_offset for HEVC codec reader.
avsw: initialized hevc_mp4toannexb filter.
avsw: start predecode.
avsw: GetHeader: changed 753 bytes -> 732 bytes by hevc_mp4toannexb.
avsw: GetHeader: 732 bytes.
avsw: initialized hevc codec context for parser: time_base: 1001/24000, pkt_timebase: 1/1000.
avsw: fps decoder invalid: false
[hevc @ 00000196bd01b7e0] Invalid NAL unit 19, skipping.
avsw: read 128 packets.
avsw: checking 111 frame samples.
avsw: stream timebase 1001/24000
avsw: decoder fps     24000/1001
avsw: duration histgram of 2 frames
avsw:  42 [ 79 frames]
avsw:  41 [ 32 frames]
avsw: read 256 packets.
avsw: checking 239 frame samples.
avsw: stream timebase 1001/24000
avsw: decoder fps     24000/1001
avsw: duration histgram of 2 frames
avsw:  42 [169 frames]
avsw:  41 [ 70 frames]
avsw: fps mul:         1001
avsw: raw avgDuration: 41.707113
avsw: estimatedAvgFps: 24001/1001
avsw: use decoder fps...
avsw: final AvgFps (raw64): 24001/1001
avsw: final AvgFps (gcd): 24000/1001
avsw: final AvgFps (round): 24000/1001
avsw: checking for stream #1
avsw: audio track 1 first pts: 0
avsw:       first pts videoIdx: 0
avsw: audio track 1 delay: 1 (timebase=0/1)
[hevc @ 00000196bd01bca0] Invalid NAL unit 19, skipping.
avsw: avsw: hevc(yv12(10bit))->p010 [AVX2], 3840x2160, 24000/1001 fps
avsw: sar 1:1, shift 0
InitInput: Success.
InitCuda: device #0.
cuInit: Success.
cuDeviceGetCount: Success.
cuDeviceGet: ID:0.
cuDeviceComputeCapability: Success: 6.1.
NVENC capabilities: OK.
using cuda schedule mode: auto.
cuCtxCreate: Success.
cuCtxPopCurrent: Success.
cuvidInit: Success.
cuvidCtxLockCreate: Success.
InitCuda: Success.
nvEncodeAPICreateInstance: Success.
NvEncOpenEncodeSessionEx: Success.
InitNVEncInstance: Success.
Eanble NVML Monitoring
Performace Monitor: none
Performace Plot   : none
createDeviceFeatureList: Success.
InitDecoder: Success.
InitFilters: Success.
SetInputParam: Success.
m_pEncodeAPI->nvEncInitializeEncoder: Success.
CreateEncoder: Success.
AllocateIOBuffers: Success.
Output: Using avformat writer.
Output: Audio/Subtitle muxing enabled.
Output: CopyAll=true
Output: Added audio track#1 (stream idx 1) for mux, bitrate 0, codec: copy
avout: output format specified:
avout: output filename: "The Dark Knight Rises (2012).nvenc.mkv"
avout: allocated internal buffer 8 MB.
avout: set external output buffer 8 MB.
avout: output video stream fps: 24000/1001
avout: opened video avcodec
avout: MaxCLL=500, MaxFALL=200
avout: Mastering Display: R(0.265000,0.690000) G(0.150000,0.060000) B(0.680000 0.320000) WP(0.312700, 0.329000) L(3999.999900,0.005000)
avout: set AV_PKT_DATA_MASTERING_DISPLAY_METADATA
avout: set AV_PKT_DATA_CONTENT_LIGHT_LEVEL

I don't see any error messages that could provide some information on what is causing the crash.

@rigaya
Copy link
Owner

rigaya commented May 3, 2018

Thank you, I have fixed this issue in NVEnc 4.01.

@lgoncal
Copy link

lgoncal commented May 13, 2018

Using NVEncC 4.01
When muxing to mkv master display data will not show up in MediaInfo, but will if I mux to mp4
If I then use MKVToolNix, latest version, to mux the mp4 to mkv master display data is now reported by MediaInfo
Using a vapoursynth script as input

@foXaCe
Copy link

foXaCe commented May 17, 2018

I have exactly the same problem

@rigaya
Copy link
Owner

rigaya commented May 23, 2018

When using option below,

--log-level debug -c hevc --profile main10 --max-cll 552,190 --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(39999999,50)

Debug message from libavformat shows that metadatas are passed correctly.

    encoding_tool   : NVEncC (x86) 4.03
    encoder         : Lavf58.15.100
    Stream #0:0, 0, 1/1000: Video: hevc (Main 10), 1 reference frame, yuv420p10le(progressive, left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 1k tbn
    Side data:
      Mastering Display Metadata, has_primaries:1 has_luminance:1 r(0.2650,0.6900) g(0.1500,0.0600) b(0.6800 0.3200) wp(0.3127, 0.3290) min_luminance=3999.999900, max_luminance=0.005000
      Content Light Level Metadata, MaxCLL=552, MaxFALL=190

Also, checking the properties of mkv file written by mkvtoolnix, it seems to be fine.
image

However, something is wrong when checked by MediaInfo, I'be not been able to figure out why.
MaxCLL & MaxFALL is wrong.
image

@lgoncal
Copy link

lgoncal commented May 23, 2018

After updating to 4.02 I found the problem to be solved
The information now shows up fine
Might it be a MediaInfo version issue, a bug in a particular version?

@pwacooijmans
Copy link

the input master display string from harry potter is incorrect....the values you see in media info need to be calculated like this: G(x times 50000,y times 50000)B(x times 50000,y times 50000)R(x times 50000,y times 50000)WP(x times 50000,y times 50000)L(x times 10000,y times 10000) meaning the L(x must be wrong) one can only increase the value by 0.0001 or 1/10000th and the rest of the values can only be increased with 0.00002 or 1/50000th other values WILL GIVE ERRORS!!!

@pwacooijmans
Copy link

pwacooijmans commented May 28, 2018

These are the correct values for harry potter: Mastering display color primaries: R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance: min: 0.0050 cd/m2, max: 4000.0000 cd/m2

So this should be the correct string:
G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(40000000,50)

@pwacooijmans
Copy link

Secondly your tv is from the year 2017 meaning your tv can ONLY process up to 25000kilobits AVG per second and 40000 MAXIMUM per second for JUST the videostream. EVERYTHING together is a maximum of 50000 kilobits per second meaning h265, audio, subtitles, chapters and tags.
Sorry to bring it to you like this but LG likes marketing just as bad as any other company :) Meaning you have been tricked cuz your tv ONLY supports the OLD BD50 standard limitations and not the NEW BDXL standard limitations. HOWEVER it should play h265 just fine is it sticks within these boundries.

@darkforcesjedi
Copy link

I am also having trouble encoding anything with nvencc64 version 4.14 that will play on my LG OLED TV (mine is OLED65B6P from 2016). It appears that nothing encoded using my GPU will play on my TV. I've tried just encoding 8-bit, video only in h264 and h265 using mp4 and mkv containers but none of the files play on my TV.

My source files are direct remux from UHD Blu-Ray disc to mkv container. The source files will play on the TV but stutter because it can't decode them fast enough. I did some test encodes using x264 and x265 encoders and those will play on the TV. I don't know enough about these codecs to be able to troubleshoot the problem adequately.

Is there any information I might be able to provide that could help get this issue resolved?

@ls-milkyway
Copy link

Simply ...some TV fail to play VBR encodes use CQP instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants