Jump to content


Photo

H.264 and H.265 transcoding with NVDEC results in green video


  • Please log in to reply
37 replies to this topic

#21 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 19 March 2019 - 10:56 AM

@softworkz thank you for all the info. I am trying to understand all of this. But, it still seems like something isn't meshing. The movie I am trying to transcode is below.

 

"Codec":"hevc","Language":"eng","ColorTransfer":"smpte2084","ColorPrimaries":"bt2020","ColorSpace":"bt2020nc","TimeBase":"1/1000","CodecTimeBase":"1001/24000","Title":"2160p / 23.976 fps / 16:9 / Main 10 Profile 5.1 High / 4:2:0 / 10 bits / HDR / BT.2020 /","VideoRange":"HDR","DisplayTitle":"4K HEVC","DisplayLanguage":"English","IsInterlaced":false,"BitRate":63643178,"RefFrames":1,"IsDefault":true,"IsForced":false,"Height":2160,"Width":3840,"AverageFrameRate":23.9760246,"RealFrameRate":23.9760246,"Profile":"Main 10","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p10le","Level":153,"IsAnamorphic":false

 

According to Nvidia's site my GTX 1060 should support NVDEC decoding and encoding of that codec. But, if you look at the attached log it is failing back to software decoding. Can you look at this again? 

Attached Files



#22 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 19 March 2019 - 11:41 AM

Thanks for reporting. 

 

In the next beta, we're going back to CUVID decoders. I think this has been enough torture for our beta users.

Chances are that it might work then, but that doesn't change anything about what I've written regarding HDR videos in general...



#23 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 19 March 2019 - 01:46 PM

Thanks for reporting. 

 

In the next beta, we're going back to CUVID decoders. I think this has been enough torture for our beta users.

Chances are that it might work then, but that doesn't change anything about what I've written regarding HDR videos in general...

Wouldnt that be a step backwards? The Nvidia CUVID decoder is deprecated now, in favor of the Codec SDK. 

 

https://docs.nvidia....oder/index.html

 

Looks like the SDK is compatible with the version of ffmpeg you guys are using for Emby. Would just need to compile the ffmpeg binary right? 

 

https://developer.nvidia.com/ffmpeg



#24 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 19 March 2019 - 02:50 PM

Wouldnt that be a step backwards? The Nvidia CUVID decoder is deprecated now, in favor of the Codec SDK. 

 

https://docs.nvidia....oder/index.html

 

Uuhh, no!

 

NVCUVID is not the same as CUVID decoders in ffmpeg.

 

In the world of ffmpeg, there are cuvid and nvdec decoders.

The former are full standalone codecs while the the latter are hwaccels plugging into the ffmpeg codecs.

 

If you want to know more, you'd need to do a little research on your own... ;-)



#25 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 19 March 2019 - 03:14 PM

Uuhh, no!

 

NVCUVID is not the same as CUVID decoders in ffmpeg.

 

In the world of ffmpeg, there are cuvid and nvdec decoders.

The former are full standalone codecs while the the latter are hwaccels plugging into the ffmpeg codecs.

 

If you want to know more, you'd need to do a little research on your own... ;-)

Believe me I am trying, gone are the days of just plopping in a disc in a blu ray player and watching a movie. Now I gotta know stuff to watch movies. lol.

 

I am still trying to find out how to tell if a mkv file is in fact 10 bit or 8 bit. According to what I have read the Main 10 hevc profile supports both. I've used ffprobe on a few different movies to see the video and audio information. I can't for the life of me find anywhere on the web which says what to look at to see if an mkv is 10 or 8 bit. The only reason I said most of my 4K content was 10 bit earlier was because thats what the file names were called. 

 

Getting back to CUVID, is that a software decorder? So your saying your going to be removing all hwaccels so the GPU isn't used for transcoding? 

 

This might not be whats happening, as I said this is all pretty foreign to me. But, could it be that there's a missing parameter when trying to use the NVENC encoder? This is the ffmpeg call from Emby. 

 

C:\Program Files\Emby Server\system\ffmpeg.exe -probesize 1000000 -hwaccel nvdec -hwaccel_device 0 -hwaccel_output_format cuda -c:v hevc -f matroska -i file:"D:\Movies\The Commuter (2018)\The Commuter (2018).mkv" -threads 0 -map 0:0 -map 0:1 -map -0:s -c:v:0 h264_nvenc -filter_complex "[0:0]scale_cuda=w=trunc(min(max(iw\,ih*dar)\,1920)/2)*2:h=trunc(ow/dar/2)*2" -b:v:0 9616000 -maxrate 9616000 -bufsize 19232000 -profile:v:0 high -g:v:0 72 -keyint_min:v:0 72 -sc_threshold:v:0 0 -copyts -vsync -1 -codec:a:0 ac3 -metadata:s:a:0 language=eng -disposition:a:0 default -ac:a:0 6 -ab:a:0 384000 -ar:a:0 48000 -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_write_temp 1 -segment_list_type m3u8 -segment_start_number 0 -segment_list "C:\Media\Transcoding\transcoding-temp\0fda4c533f5c6df0c32f0ea888415f03.m3u8" -y "C:\Media\Transcoding\transcoding-temp\0fda4c533f5c6df0c32f0ea888415f03%d.ts"

 

Resulting in this error: 

 

[h264_nvenc @ 000001eebd3e3200] Provided device doesn't support required NVENC features
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

 

Looking at the ffmpeg.org website and the Nvidia encoders and encoders (https://trac.ffmpeg....ki/HWAccelIntro) it says if ffmpeg throws an error that the -pixel-format parameter might be needed. I did notice that the call above to ffmpeg doesnt have that parameter in it. 

 

I appreciate you taking the time to be involved with this and help me understand. 

 

Do I also need the Nvidia video codec SDK installed as it states on the ffmpeg website to make this work? 

 

NVENC can be used for H.264 and HEVC encoding. FFmpeg supports NVENC through the h264_nvenc and hevc_nvenc encoders. In order to enable it in FFmpeg you need:


Edited by IkeTaylor11, 19 March 2019 - 03:16 PM.


#26 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 19 March 2019 - 03:35 PM

Getting back to CUVID, is that a software decorder? So your saying your going to be removing all hwaccels so the GPU isn't used for transcoding? 


Absolutely no. the ffmpeg codecs called cuvid are using the same hw acceleration as the ones called nvdec. 
 

Do I also need the Nvidia video codec SDK installed as it states on the ffmpeg website to make this work?

 

No. Install latest Nvidia drivers. Install Emby. Done.



#27 pwhodges OFFLINE  

pwhodges

    Advanced Member

  • Members
  • 200 posts
  • Local time: 10:39 PM
  • LocationOxford, UK

Posted 19 March 2019 - 04:46 PM

 

I am still trying to find out how to tell if a mkv file is in fact 10 bit or 8 bit.  I can't for the life of me find anywhere on the web which says what to look at to see if an mkv is 10 or 8 bit. 

 

I use Mediainfo to show me this information.


Edited by pwhodges, 19 March 2019 - 04:48 PM.


#28 mbo OFFLINE  

mbo

    Advanced Member

  • Members
  • 46 posts
  • Local time: 11:39 PM

Posted 20 March 2019 - 06:10 AM

@softworkz

I started using the beta version to fix hw accelerated encoding problems. Currently hw de/encoding does not work at all (for me with nvenc/dec) but there seems to be an "easy" fix if you could change the encoding profile and/or use current versions of ffmpeg (but that might be a missunderstanding on my side).

 

Can i test ffmpeg encoding changes by myself? I can use the bundled ffmpeg but could you provide information about the bundled version? It says it is version 4.0.3 which might not be the current version. Can i somehow change the ffmpeg settings myself (pixel format, profile etc.) ?

e.g. high444p does not work, high profile does.

 

Cheers



#29 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 20 March 2019 - 03:25 PM

Even though our bundled version says 4.0.3, we're actually equal to the current master branch of ffmpeg (regarding all hw accelerations)!

 

We've internally prepared for allowing individual codec configurations but it will take a while until we will have that.

 

But please open a new topic and post log files (unless you problem is related to the topic of this thread).



#30 mbo OFFLINE  

mbo

    Advanced Member

  • Members
  • 46 posts
  • Local time: 11:39 PM

Posted 20 March 2019 - 04:35 PM

Thanks for the clarification !

I already created a thread and awaiting your comment :)

https://emby.media/c...es/#entry719125

#31 mbo OFFLINE  

mbo

    Advanced Member

  • Members
  • 46 posts
  • Local time: 11:39 PM

Posted 20 March 2019 - 09:02 PM

Nevermind. With the latest driver (release 2019-03-20) hardware accelerated encoding/decoding on nvidia works again - and i have the same "green screen" problem.



#32 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 21 March 2019 - 01:32 PM

@softworkz I wanted to give a more in depth investigation as to what I am seeing with transcoding. I tried playing 3 different movies. 2 of them were 10bit and 1 was 8bit. The results are below and there is a transcoding attachment for each playback scenario. It seems that subtitles cause some sort of issue depending on the subtitle type for both 10bit and 8bit. 10bit playback without subtitles on at all will not use NVENC/DEC at all, it always fails to software transcoding. Hope this helps get to the bottom of this. Thank you. 

 

Red Sparrow - 8bit - Subtitles: English (Default SUBRIP)
 - results in correct playback and uses NVENC/DEC encoding and decoding
 - log file: red_sparrow_subrip_transcode.txt
 
Red Sparrow - 8bit - Subtitles: English (PGSSUB)
 - results in green playback and uses NVENC/DEC encoding and decoding
 - log file: red_sparrow_pgssub_transcode.txt
 
Red Sparrow - 8bit - Subtitles: Off
 - results in correct playback and uses NVENC/DEC encoding and decoding
 - log file: red_sparrow_nosubs_transcode.txt
 
The Commuter - 10bit - Subtitles: English (Default PGSSUB)
 - results in green playback and uses NVENC/DEC encoding and decoding
 - log file: the_commuter_pgssub_transcode.txt
 
The Commuter - 10bit - Subtitles: Off
 - results in correct playback with HEVC/H.264(AVC) software encoding and decoding
 - NVENC/DEC fails 
 - log file: the_commuter_nosubs_transcode.txt
 
Ready Player One - 10bit - Subtitles: English (Default SUBRIP)
 - results in frozen client on black screen even though dashboard shows transcoding and playing
 - log file: ready_player_one_subrip_transcode.txt
 
Ready Player One - 10bit - Subtitles: English (PGSSUB)
 - results in green playback and uses NVENC/DEC encoding and decoding
 - log file: ready_player_one_pgssub_transcode.txt
 
Ready Player One - 10bit - Subtitles: Off
 - results in correct playback with HEVC/H.264(AVC) software encoding and decoding
 - NVENC/DEC fails 
 - log file: ready_player_one_nosubs_transcode.txt
 

Attached Files


  • akawoz likes this

#33 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 21 March 2019 - 07:18 PM

@IkeTaylor11 - Thanks for taking the time to put this together.

 

A new beta is out. Please let me know how it goes...


  • mbo likes this

#34 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 21 March 2019 - 10:52 PM

@IkeTaylor11 - Thanks for taking the time to put this together.

 

A new beta is out. Please let me know how it goes...

 

I tested with the same movies using subtitles that i tested earlier. All of them are playing back correctly with subtitles enabled, but SUBRIP and PGSSUB work without any green playback on both 8bit and 10bit. Theres still transcoding issues but i will post those results in the other thread specifically for NVENC encoding. It appears the green playback issue is resolved.



#35 softworkz OFFLINE  

softworkz

    Advanced Member

  • Developers
  • 1531 posts
  • Local time: 11:39 PM

Posted 21 March 2019 - 11:18 PM

That's good news! Thanks for taking the time to test this.



#36 IkeTaylor11 OFFLINE  

IkeTaylor11

    Advanced Member

  • Members
  • 331 posts
  • Local time: 04:39 PM

Posted 21 March 2019 - 11:25 PM

That's good news! Thanks for taking the time to test this.

Thank you for working on this. Doing good work, keep it up. 


  • cayars likes this

#37 rrp OFFLINE  

rrp

    Newbie

  • Members
  • 5 posts
  • Local time: 10:39 PM

Posted 29 March 2019 - 06:45 PM

Hi

is there also a new emby beta (currently running Version 4.1.0.17 beta) for QNAP x86_64, QTS 4.3.6 ,  I am having the same issue with ts-673 + nvidia Quadro p620. green screen. this one is giving also issues NVDEC Quadro P620 - H.265 (HEVC)

This issue is also with stable release

thx


Edited by rrp, 29 March 2019 - 06:47 PM.


#38 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 131462 posts
  • Local time: 05:39 PM

Posted 29 March 2019 - 09:33 PM

Hi, betas can be found on the download page of our website. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users