Jump to content
marianob85

Stream configuration - use NVidia cuda to transcode stream

Recommended Posts

marianob85

Hi, 

 

I'm trying to figure out, if it's possible to use nvidia card to transcode stream. Because I can not use single stream and the only way is to use 'play in browser' functionality, i need to improve transcoding of HD streams. 

 

I've modify a little bit c:\Program Files (x86)\DVBViewer\config\ffmpegprefs.ini  and change {threads} to const value of 4. I don't know who is managing  {threads} variable but it seems it it set to 1. After changing to 4, I am able to watch HD movies smoothly but CPU usage is too high ( ~80% ). That's why I would like to use NVIdia GPU to transcode the signal. Did anyone tried something like that ?

 

Regards,

Mariusz.

 

Share this post


Link to post
Tjod

In the current DMS Version the {threads} part isn't used any more. And I think in the last RS it was the same.

Make sure you are using the last RS version.

 

Then delete the c:\Program Files (x86)\DVBViewer\config\*.ini while the RS is stopped an start a stream so that the RS generates the current version.

 

If you start modifying it is the best to start with the newest version.

If you look in C:\ProgramData\CMUV\DVBViewer\svcdebug.log you can see what the RS exactly send parameter wise to the ffmpeg.exe.

 

Then you have to check that the ffmpeg.exe in the RS folder supports nvenc

https://trac.ffmpeg.org/wiki/HWAccelIntro

https://developer.nvidia.com/ffmpeg

 

And for testing parameters I would use a recording and transcode it with a batch file:

http://www.DVBViewer.tv/forum/topic/55397-automatisch-eine-mp4-aus-aufnahmen-generieren/?do=findComment&comment=439953

 

And only if it works there go to the more complicate part of live TV.

 

For Intel Quick Sync there are already configuration files:

http://www.DVBViewer.tv/forum/topic/58039-intel-quick-sync-video-unterstützung/

Share this post


Link to post
marianob85

I have right now the latest version of DMS. I've recreated the ffmpegprefs.ini, download latest ffmpeg and unfortunately I'm not able to watch anything using TS or flash configuration using original  ffmpegprefs.ini. Only WebM are working correctly. The problem is that h264_nvenc doesn't support "webm" and I need to use mpegts. Any advice ?

 

BTW. Using batch file I was able to use h264_nvenc without any problems

"ffmpeg.exe" -analyzeduration 1500k  -i "Test.ts" -c:v h264_nvenc -mpegts_original_network_id 8808 -mpegts_transport_stream_id 3 -mpegts_service_id 1 -mpegts_service_type 1 -metadata service_name="TVP1 HD (pol)" -pat_period 0.2 -bufsize 6400k -maxrate 3200k -crf 20 -g 50 -r 25.0 -map 0:v:0 -map 0:a:0 -preset medium  -acodec libmp3lame -ab 128k -ar 44100 -ac 2  -async 1 -y "out.ts"

but for that I need to use mpegts.

 

Share this post


Link to post
Tjod

What client are you using?

Web browser don't support .ts streams.

And for Flash you need the plugin.

Share this post


Link to post
marianob85

Chrome :) or IE. So what support TS stream ? VLC ?

Share this post


Link to post
Tjod

Yes VLC and other stand alone player.

Share this post


Link to post
marianob85

Thanks. Works perfectly with h264_nvenc and hevc_nvenc. CPU usage is about 5%-10%, Video Engine Load ~5-19% ( depend of used codec )

Edited by marianob85

Share this post


Link to post
Josezkaos
On 15/10/2017 at 3:18 PM, Tjod said:

And only if it works there go to the more complicate part of live TV.

 

For Intel Quick Sync there are already configuration files:

http://www.DVBViewer.tv/forum/topic/58039-intel-quick-sync-video-unterstützung/

 

Talking about HWAccels ... I have one question about QSV and RS.

 

Those configuration files just take advantage of QSV Encoding, but not QSV Decoding.

 

That means decoded frames have to be moved from system memory to graphic card memory, lowering performance a lot (my Intel NUC lowers encoding performance to 0.2X in a few minutes... useless).

 

After some research, I've found how to get FFMPEG QSV working on Decoding (easy) and Encoding (easy) with Live Streams (not that easy)... My Intel NUC i5 now stays for more than an hour working perfectly transcoding to H264/1080p50 using FFMPEG QSV).

 

The thing is FFMPEG QSV Decoder NEEDS the input stream to start with an IFrame.

 

Trying to Seek into an IFrame directly in the command line doesn't work ("-ss 1 -noaccurate_seek"), but copying the stream into a pipe, and using that pipe as input works.

 

Applied to ffmpegprefs.ini, it should be like this:

 

[PIPE TEST]
Cmd=-i "{infile}" -vcodec copy -acodec copy -f mpegts pipe:1 | ffmpeg.exe -ss 1 -noaccurate_seek -hwaccel qsv -y -vcodec h264_qsv -i pipe:0 -vcodec h264_qsv -bufsize 4M -b:v 3200k -r 50 -map 0:a:0 -map 0:v:0 -vf deinterlace_qsv -acodec aac -ab 256k -ar 48000 -async 1 -y "{outfile}"
maxWidth=1920
maxHeight=1080
MimeType=video/mpeg
Ext=.ts
Delay=2000

 

But it doesn't work on RS (it does on FFMPEG CLI!!!)... DVBViewer Directory contains the same FFMPEG version I'm using on command line (last one from Zeranoe).

 

That  "|" symbol seems not to be working on RS, as there's only one ffmpeg instance running. Moreover, it doesn't return any transcoded stream.

 

Is there anyway to make it work on RS?

 

Thanks!

 

 

Share this post


Link to post
majstang

Wow, this reseach of yours could mean huge improvements:) Or maybe FFMPEG QSV Decoding is already enabled for the DMS, which is payware and still in development (a lot of features added), which RS isnt. Have you tried any transcoded streams with DMS?

Share this post


Link to post
Griga
1 hour ago, majstang said:

Or maybe FFMPEG QSV Decoding is already enabled for the DMS

 

No special measures have been taken for it.

Share this post


Link to post
Griga

P.S. Some users made it work. See this lengthy German thread (you may need Google translator or something like that).

Share this post


Link to post
Josezkaos

Thanks Griga,

 

But as I commented before, they are just using QSV for Encoding, here is a trace from that thread:

 

Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))

 

With my "PIPE TEST" under FFMPEG (RS doesn't execute the pipe) it shows:

 

FIRST (first FFMPEG, copy stream into pipe):

Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)

 

SECOND (second FFMPEG rigth after pipe, decoding and encoding using QSV):

Stream mapping:
  Stream #0:1 -> #0:0 (eac3 (native) -> aac (native))
  Stream #0:0 -> #0:1 (h264 (h264_qsv) -> h264 (h264_qsv))

 

 

When I get the Native->H264_QSV performance lowers from 4X to 0.2X in a couple of minutes, being useless under 1X.

 

When I get H264_QSV->H264_QSV performance lowers from 4X to 1.01X but not less (guess it lowers to 1X because it can't encode more than it gets from input). Using as input an MKV file it runs at 4-6X.

Share this post


Link to post
bogdan1980
On 21.10.2017 at 2:44 PM, marianob85 said:

Thanks. Works perfectly with h264_nvenc and hevc_nvenc. CPU usage is about 5%-10%, Video Engine Load ~5-19% ( depend of used codec )

Could you post ffmpegprefs.ini  and iphoneprefs with nvenc ?

Share this post


Link to post

×
×
  • Create New...