Jump to content

GPU Transcoding (Intel QuickSync and nVidia NVENC)


witteschnitte

Recommended Posts

Hi,

 

Thanks for the new build! I guess this isn't working in dev :( . QSV Transcode of live TV has been broken for a while. Not sure what Luke added on the 6th, so I don't know what the use case is.

 

 

-vicpa

 

Does the new build address the VPP issues?

Link to comment
Share on other sites

So then the encode with QSV isn't going to work? Then this is the problem.

 

"-sn -codec:v:0 h264_qsv -force_key_frames expr:gte(t,n_forced*5) -vf "yadif=0:-1:0:flags=fast_bilinear" -pix_fmt yuv420p -preset 7 -b:v 20954238 -vsync vfr -profile:v high -level 4.1 -map_metadata -1 -threads 0 -codec:a:0 aac -strict experimental -ac 6 -ab 320000 -af "aresample=async=1" -y "G:\MB-Temp\transcoding-temp\be1d12563b1da3fa09c68774dedede10.ts"

 

The qsv needs to be on the decode side.

 

 

edit decode side

Edited by Vicpa
Link to comment
Share on other sites

Still enabled by default. Should add " -look_ahead 0" to encoder config to disable it.

 

Thanks for checking & binaries !

 

I tried with latest dev build (3.0.5793.19407) and found that ffmpeg is updated to latest one (didn't check the changelog, but maybe you merged it?)

 

By default, it looks like don't use qsv for encode but only for decode so it works but slow :

Original parameters:

C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\ffmpeg\20151111\ffmpeg.exe -loglevel debug -ss 00:40:28.962 -fflags +genpts -c:v h264_qsv  -i file:"D:\contents\Movies\video.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -force_key_frames expr:gte(t,n_forced*5) -pix_fmt yuv420p -preset superfast -crf 23 -b:v 2680000 -vsync vfr -profile:v high -level 41 -map_metadata -1 -threads 2 -codec:a:0 aac -strict experimental -ac 6 -ab 320000 -af "aresample=async=1" -y "C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\transcoding-temp\2e89eaa95a14531c4720727f0a04366b.ts"


frame=  163 fps= 11 q=24.0 size=    3423kB time=00:00:06.89 bitrate=4069.6kbits/
frame=  169 fps= 11 q=23.0 size=    3539kB time=00:00:07.14 bitrate=4056.8kbits/
frame=  175 fps= 11 q=24.0 size=    3639kB time=00:00:07.40 bitrate=4026.8kbits/
frame=  181 fps= 11 q=23.0 size=    3737kB time=00:00:07.61 bitrate=4019.5kbits/
frame=  186 fps= 11 q=24.0 size=    3821kB time=00:00:07.87 bitrate=3976.1kbits/

...

 

 

Fps: ~11

 
 

So I tried put "-look_ahead 0" and changed encoder to "h264_qsv" manually, but it shows parameter error at "-preset" option :

[h264_qsv encoder @ 000000ee9ddb54a0] [Eval @ 000000ee98b7e690] Undefined consta
nt or missing '(' in 'superfast'
[h264_qsv encoder @ 000000ee9ddb54a0] Unable to parse option value "superfast"
[h264_qsv encoder @ 000000ee9ddb54a0] Error setting option preset to value super
fast.
Output #0, mpegts, to 'C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server
\transcoding-temp\2e89eaa95a14531c4720727f0a04366b.ts':
...
    Stream #0:0, 0, 0/0: Video: h264, 1 reference frame, none, q=2-31, 128 kb/s,
 SAR 1:1 DAR 0:0, 23.98 fps (default)
    Metadata:
      encoder         : Lavc57.15.100 h264_qsv
    Stream #0:1, 0, 0/0: Audio: aac, 0 channels, 128 kb/s (default)
    Metadata:
      encoder         : Lavc57.15.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters
such as bit_rate, rate, width or height
[AVIOContext @ 000000eea2760220] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 000000ee9a5d5fc0] Statistics: 2560180 bytes read, 3 seeks

So I removed that option and it result ~27 fps w/o error.

 

It is quite impressing result considering the source is 1080p h264 video and my system is Baytrail J1800 dualcore !

Final parameters: 

C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\ffmpeg\20151111\ffmpeg.exe -ss 00:40:28.962 -fflags +genpts -c:v h264_qsv  -i file:"D:\contents\Movies\video.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -force_key_frames expr:gte(t,n_forced*5) -pix_fmt yuv420p -crf 23 -b:v 2680000 -vsync vfr -profile:v high -level 41 -map_metadata -1 -threads 2 -look_ahead 0 -codec:a:0 aac -strict experimental -ac 6 -ab 320000 -af "aresample=async=1" -y "C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\transcoding-temp\2e89eaa95a14531c4720727f0a04366b.ts"


Fps: ~27

    Metadata:
      encoder         : Lavc57.15.100 h264_qsv
    Stream #0:1: Audio: aac, 48000 Hz, 5.1, fltp, 320 kb/s (default)
    Metadata:
      encoder         : Lavc57.15.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
...
frame=  887 fps= 27 q=-0.0 size=   13625kB time=00:00:37.18 bitrate=3001.7kbits/
frame=  905 fps= 27 q=-0.0 size=   13920kB time=00:00:37.82 bitrate=3014.8kbits/
frame=  906 fps= 27 q=-0.0 Lsize=   14009kB time=00:00:38.10 bitrate=3012.1kbits
...

So it looks like little changes on ffmpeg options can activate qsv encoders.

 

Anyone knows put customized options to ffmpeg?

Edited by testype
Link to comment
Share on other sites

Great, thanks. I will add look_ahead to the next dev build.

 

Please consider modify "-preset" option also.

 

As I wrote above, current value (-preset superfast) causes error with h264_qsv, even with "-look_ahead 0".

Link to comment
Share on other sites

Do we still need to replace the ffmpeg executable in order to use qsv?

 

 

Sent from my iPhone using Tapatalk

Edited by tjalfe
Link to comment
Share on other sites

On the latest dev build, I can use h264_qsv w/o any issue once transcoding setting is set to quicksync!
Confirmed use -look_ahead 0 also no -preset used.

Thanks all!

 

 

--edit--

 

after some video play, now server shows exception on every request when it set as quicksync (Transcode - Auto is OK).

2015-11-12 21:43:44.3269 Info HttpServer: HTTP GET http://myhomepage:8096/videos/7981326d740e2aa8903c31501b5a36c3/stream.ts?DeviceId=317d8fe4-fed7-6ac8-3597-960500012398&MediaSourceId=7981326d740e2aa8903c31501b5a36c3&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=2680000&AudioBitrate=320000&MaxAudioChannels=6&Level=41&ClientTime=635829290237158024&Profile=high&PlaySessionId=7ce369a27f24421e89c94b50c50e74ed&api_key=78cb082c485249b49bed552c44f1d8c8&StartTimeTicks=0. UserAgent: VLC/3.0.0-git LibVLC/3.0.0-git
2015-11-12 21:43:44.3269 Error DtoUtils: ServiceBase<TRequest>::Service Exception
	*** Error Report ***
	Version: 3.0.5793.39757
	Command line: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
	Operating system: Microsoft Windows NT 6.2.9200.0
	Processor count: 2
	64-Bit OS: True
	64-Bit Process: False
	Program data path: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server
	Application Path: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
	System.ArgumentOutOfRangeException
	   위치: System.ThrowHelper.ThrowArgumentOutOfRangeException()
	   위치: MediaBrowser.Api.Playback.BaseStreamingService.GetOutputSizeParam(StreamState state, String outputVideoCodec, Boolean allowTimeStampCopy)
	   위치: MediaBrowser.Api.Playback.Progressive.VideoService.GetVideoArguments(StreamState state, String codec)
	   위치: MediaBrowser.Api.Playback.Progressive.VideoService.GetCommandLineArguments(String outputPath, StreamState state, Boolean isEncoding)
	   위치: MediaBrowser.Api.Playback.BaseStreamingService.GetOutputFilePath(StreamState state)
	   위치: MediaBrowser.Api.Playback.BaseStreamingService.<GetState>d__2d.MoveNext()
	
2015-11-12 21:43:44.3269 Error HttpServer: Error processing request for /videos/7981326d740e2aa8903c31501b5a36c3/stream.ts?DeviceId=317d8fe4-fed7-6ac8-3597-960500012398&MediaSourceId=7981326d740e2aa8903c31501b5a36c3&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=2680000&AudioBitrate=320000&MaxAudioChannels=6&Level=41&ClientTime=635829290237158024&Profile=high&PlaySessionId=7ce369a27f24421e89c94b50c50e74ed&api_key=78cb082c485249b49bed552c44f1d8c8&StartTimeTicks=0
	*** Error Report ***
	Version: 3.0.5793.39757
	Command line: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
	Operating system: Microsoft Windows NT 6.2.9200.0
	Processor count: 2
	64-Bit OS: True
	64-Bit Process: False
	Program data path: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server
	Application Path: C:\Users\Administrator.WINNAS\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
	ServiceStack.HttpError
	No Stack Trace Available

Any idea?

Edited by testype
Link to comment
Share on other sites

Unfortunately I don't think this is going to work on FreeBSD right? So FreeNAS won't be an option? Or in FreeNAS do you use a Linux Jail for the plugin?

Link to comment
Share on other sites

  • 2 weeks later...
Deihmos

can you try again? there's nothing obvious there.

 

 

There was just another update and I have the same results. When i turn off qs it works again but with on nothing happens. the temp folder had one 17KB file. 

Link to comment
Share on other sites

Deihmos

can you try again? there's nothing obvious there.

 

 

There was just another update and I had the same results. When i turn off qs it works again but with on nothing happens. the temp folder had one 17KB file. 

 

 

Transcode.txt

Edited by Deihmos
Link to comment
Share on other sites

There was just another update and I had the same results. When i turn off qs it works again but with on nothing happens. the temp folder had one 17KB file. 

 

and it's fine with video files?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...