Jump to content


Photo

FFmpeg not using NVENC

ffmpeg nvenc GTX 1050 Linux/Ubuntu(Server) 16.04

  • Please log in to reply
78 replies to this topic

#41 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 27 February 2017 - 03:30 AM

If you look on top of the card, you should see either a 6-pin or an 8-pin header. Your power supply should have a cable that can plug into that. Now, some graphics cards come with molex to 6/8-pin adapters, but are usually unnecessary for more modern power supplies.

#42 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 27 February 2017 - 09:27 AM

I'm also considering switching to a Quicksync setup (Kabby Lake)  simply because Nvidia's stupid 2-stream limit for their consumer cards.  I'd be interested in your experience if you go that way.



#43 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 27 February 2017 - 06:56 PM

Hmmm, I thought that NVENC had a 3-stream max. It's not a limit, per say, but more of a hardware maximum. It all comes down to a price. Quicksync has a theoretical max of 5, according to Tom's Hardware(maybe?), but I think if you are decoding something such as HEVC to 264, then it'll use up 2 of those slots. My server has an 1155 motherboard and I don't want to put the money out for Skylake or above. I might put a video on my YouTube channel about Quicksync and it's functionality/usability.



#44 thejacer87 OFFLINE  

thejacer87

    Advanced Member

  • Members
  • 132 posts
  • Local time: 02:15 AM
  • LocationKelowna, BC

Posted 27 February 2017 - 09:12 PM

can you explain why you need the encoding and decoding? from what ive gathered, nvenc will use the gpu to help take a big bluray file and convert it to a format that can be viewed on the apps that may not have the right codecs. what would you need the decode for?



#45 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 27 February 2017 - 09:18 PM

There are two things you need to know about: encoding and decoding. Decoding will take the premade file, or in your case a Bluray disk, and uncompress it. You may have heard terms like H.264, HEVC or MPEG2, etc. for video codecs while audio codecs can consist of AAC, DTS, AC3, etc. Emby needs to encode the uncompressed information into something that is both smaller and so the client device can understand better and more efficiently.



#46 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 27 February 2017 - 11:11 PM

Hmmm, I thought that NVENC had a 3-stream max. It's not a limit, per say, but more of a hardware maximum. It all comes down to a price. Quicksync has a theoretical max of 5, according to Tom's Hardware(maybe?), but I think if you are decoding something such as HEVC to 264, then it'll use up 2 of those slots. My server has an 1155 motherboard and I don't want to put the money out for Skylake or above. I might put a video on my YouTube channel about Quicksync and it's functionality/usability.

 

No, Nvidia puts a hard limit on nvenc at 2 encodes per card on their consumer cards (Geforce, Titan).  It's an artificial limit baked into the driver in order to drive high end encoders to their high end cards.

 

Their workstation or above cards (Like Quadro) are unlimited, just the max performance of the hardware.


Edited by puithove, 27 February 2017 - 11:12 PM.


#47 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 27 February 2017 - 11:19 PM

Not unlimited as it is a hardware limitation, but this post is very clear on streams per card. Seems about 3 streams on Kepler GPU's and 18 on Maxwell.

 

https://gridforums.n...post/2485/#2485



#48 Andy777 OFFLINE  

Andy777

    Advanced Member

  • Members
  • 117 posts
  • Local time: 12:15 PM

Posted 28 February 2017 - 08:10 AM

I've only ever seen software decode when transcoding with nevnc.

 

 

 

Full transcoding can be achieved when combined with Cuvid. From ffpeg wiki:

 

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input -c:v h264_nvenc -preset slow output.mkv

 

BR,

Andy777



#49 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 28 February 2017 - 08:11 AM

I didn't word it well, but I meant more like "only limited to the performance of the card".  No artificially induced hard limit.

 

No, there is a 2-session (stream) limit on consumer cards... at least up through Maxwell... I haven't seen anything on Pascal yet, but I suspect it's the same just because of Nvidia wanting to limit consumer cards.

 

See here:  https://en.wikipedia...ki/Nvidia_NVENC

"Consumer-grade GeForce cards are restricted to only two simultaneous encoding jobs at a time, while professional Quadro cards do not have this restriction."

 

And here:  https://devtalk.nvid...venc-sessions-/

 

And from my own experience, If I try to start a third, it'll just simply fail.

 

The discussion you linked to is a discussion on their non-consumer cards - They're talking about K1, K2, M6, M60, none of which are Geforce (consumer) cards.


Edited by puithove, 28 February 2017 - 08:23 AM.


#50 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 28 February 2017 - 08:15 AM

Full transcoding can be achieved when combined with Cuvid. From ffpeg wiki:

 

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input -c:v h264_nvenc -preset slow output.mkv

 

 

Nifty - I had wondered about that, but hadn't played with it.  In order for that to be workable with Emby, we'd need to have that added to the commandline that gets launched when doing a Nvidia hardware assisted transcode.

 

@Luke - thoughts?



#51 shorty1483 OFFLINE  

shorty1483

    Advanced Member

  • Members
  • 1373 posts
  • Local time: 11:15 AM
  • LocationGermany

Posted 28 February 2017 - 11:45 AM

@Andy777 @puithove @Luke

 

Nice one. Give me 80fps with a high bitrate movie, but compared to the actual process near to no CPU usage but a fully loaded Nvidia card.

 

58b59ae4d5134_Unbenannt.png58b59af8c9f1c_Unbenannt2.png58b59b01985e7_Unbenannt3.png

 

 

@TehEpikDuckeh Can confirm 2 device limit on my graphics card. A third requested stream simply won't start/times out in Emby.


Edited by shorty1483, 28 February 2017 - 11:47 AM.

  • puithove likes this

#52 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 124473 posts
  • Local time: 06:15 AM

Posted 28 February 2017 - 01:40 PM

Nifty - I had wondered about that, but hadn't played with it.  In order for that to be workable with Emby, we'd need to have that added to the commandline that gets launched when doing a Nvidia hardware assisted transcode.

 

@Luke - thoughts?

 

Add what exactly to the command line?



#53 shorty1483 OFFLINE  

shorty1483

    Advanced Member

  • Members
  • 1373 posts
  • Local time: 11:15 AM
  • LocationGermany

Posted 28 February 2017 - 03:01 PM

Perhaps @Waldonnis can also support since he seems pretty knowledged in the nvenc thing.



#54 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 28 February 2017 - 04:58 PM

@puithove, I see. I still do not agree with that wiki article that professional cards do not have limits. It just doesn't make sense. If it's hardware transcoding, there would have to be a limit somewhere. But for everything else you said, I agree.

@Luke, you implementing that CUVID codec? Do I have to go repurchase the GTX 1050 `_`

#55 TehEpikDuckeh OFFLINE  

TehEpikDuckeh

    Advanced Member

  • Members
  • 94 posts
  • Local time: 02:15 AM

Posted 28 February 2017 - 06:22 PM

@Luke, I just ran FFmpeg w/ the following command "ffmpeg -c:v h264_cuvid -i /media/HDD/Movies/Eagles\ -\ Farewell\ Tour.mkv -c:v h264_nvenc test.mkv" and it worked great! It decoded and encoded using the GPU. Any way we can implement this into Emby?

 

If anyone has a 1000 series GTX card, can you test to see if "hevc_cuvid" works for decoding a HEVC video and encoding it to h264? Thanks!



#56 thejacer87 OFFLINE  

thejacer87

    Advanced Member

  • Members
  • 132 posts
  • Local time: 02:15 AM
  • LocationKelowna, BC

Posted 28 February 2017 - 11:57 PM

so b4 all this talk get way outta my depth, if i have the nvidia drivers, johnvasickles latest build, and turn on nvenc in emby; all of this should help out the cpu with the transcoding and general playback ya?



#57 shorty1483 OFFLINE  

shorty1483

    Advanced Member

  • Members
  • 1373 posts
  • Local time: 11:15 AM
  • LocationGermany

Posted 01 March 2017 - 01:44 AM

so b4 all this talk get way outta my depth, if i have the nvidia drivers, johnvasickles latest build, and turn on nvenc in emby; all of this should help out the cpu with the transcoding and general playback ya?

 

Definitely, yes.



#58 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 01 March 2017 - 08:00 AM

Add what exactly to the command line?

 

To tell ffmpeg to use hardware decoding in addition to hardware encoding (saves significant CPU, though not nearly as much as the encoding of course) - add this on the input side of the commandline for h264 source content:

-hwaccel cuvid -c:v h264_cuvid

or this for HEVC source content:

-hwaccel cuvid -c:v hevc_cuvid

***Note:  there may be some compatibility risk here - I'm not sure how much of a risk.  There may be some differences in what the card is capable of decoding so if it's Main10 HEVC or something else weird, the card might not be able to decode.  Not sure if ffmpeg will fall back to software or if it will just fail.  I haven't played with multiple scenarios - just was able to see that it worked in transcoding some of my content at the commandline.


Edited by puithove, 01 March 2017 - 08:09 AM.


#59 puithove OFFLINE  

puithove

    Advanced Member

  • Alpha Testers
  • 721 posts
  • Local time: 06:15 AM

Posted 01 March 2017 - 08:02 AM

@puithove, I see. I still do not agree with that wiki article that professional cards do not have limits. It just doesn't make sense. If it's hardware transcoding, there would have to be a limit somewhere. But for everything else you said, I agree.

 

Of course there are performance limits to all hardware.  it (and what I mentioned) is talking about artificially software enforced session count limits in the consumer cards.

 

Also, unless you're live streaming something where FPS is critical, those pro cards are going to be capable of unlimited streams, just that once you get beyond the performance limit, it'll be doing them slower than real time - just like software transcoding on the CPU.


Edited by puithove, 01 March 2017 - 08:10 AM.


#60 shorty1483 OFFLINE  

shorty1483

    Advanced Member

  • Members
  • 1373 posts
  • Local time: 11:15 AM
  • LocationGermany

Posted 02 March 2017 - 12:04 PM

***Note:  there may be some compatibility risk here - I'm not sure how much of a risk.  There may be some differences in what the card is capable of decoding so if it's Main10 HEVC or something else weird, the card might not be able to decode.  Not sure if ffmpeg will fall back to software or if it will just fail.  I haven't played with multiple scenarios - just was able to see that it worked in transcoding some of my content at the commandline.

 

Could be a good point. Just tested a bit with HEVC (just 4:2:0 1080p stuff). My Kepler card (!!!) is able to encode HEVC to h264_nvenc with the actual Emby commands. Then I tested some stuff over cmd line. Result: As soon as cuvid comes into place, the ffmpeg command fails due to no hevc_cuvid capable device (as expected because of Nvidia documentation).


  • puithove likes this





Also tagged with one or more of these keywords: ffmpeg, nvenc, GTX 1050, Linux/Ubuntu(Server) 16.04

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users