Jump to content

VAAPI - Hardware Acceleration on Debian with Intel CPU (How I did it)


brrzba

Recommended Posts

Hi,

 

I have been fiddling around with this for too long, so here is what I did for all you after me:

 

  • Activate backported sources
  • Install backported kernel - reboot
  • Install all the packages needed for Hardware Acceleration from backports (perhaps not all of them are neccesary):
    mesa-va-drivers va-driver-all vainfo i965-va-driver mesa-vdpau-drivers libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libvdpau-va-gl1 libva-drm1 va-drive vdpau-va-driver libva-intel-drivers libdrm-intel1 
  • DONT use the static ffmpeg build linked somewhere in the install guide. For me it did not work at all. If you did, switch from custom ffmpeg to system installed in your emby interface.
  • Except install ffmpeg from debian backports
  • activate VA-API in emby

 

Thats it, I had very little idea how to do this when I started trying this. As wrongly suggested to me you dont need any xorg stuff.

Now we only need this issue fixed in stable :)

 

Hope I can help someone, also correct me if something is not right here.

Link to comment
Share on other sites

hm, seems I posted that too early. Vaapi transcoding with the exact same command line as in the emby logs works with ffmpeg, but not in emby itself..

 

It always crashes with something like that in the logs:

2016-10-03 17:28:50.1442 Info App: ffmpeg -ss 00:00:41.219 -fflags +genpts -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:"/somemovie.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -force_key_frames "expr:gte(t,n_forced*5)" -vf "format=nv12|vaapi,hwupload" -b:v 1808000 -maxrate 1808000 -bufsize 3616000 -vsync -1 -level 41 -map_metadata -1 -threads 0 -codec:a:0 aac -strict experimental -ac 6 -ab 192000 -af "aresample=async=1" -f mp4 -movflags frag_keyframe+empty_moov -y "/emby/transcode/transcoding-temp/a2b41f3f7b04f453af7b5fd82305bb6f.mp4"
2016-10-03 17:28:50.3279 Info HttpServer: HTTP Response 200 to 192.168.0.210. Time: 222ms. http://server.lan:8096/emby/Videos/a9b589c6898158e98e3c63f242f82fc6/a9b589c6898158e98e3c63f242f82fc6/Subtitles/2/412191150/Stream.vtt
2016-10-03 17:28:51.5252 Info HttpServer: HTTP POST http://server.lan:8096/emby/Sessions/Playing/Stopped. UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
2016-10-03 17:28:51.5354 Info App: Stopping ffmpeg process with q command for /emby/transcode/transcoding-temp/a2b41f3f7b04f453af7b5fd82305bb6f.mp4
2016-10-03 17:28:51.5913 Error ServiceStackHost: Error occured while Processing Request: Unable to write data to the transport connection: The socket has been shut down.
	*** Error Report ***
	Version: 3.0.7300.0
	Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
	Operating system: Unix 4.7.0.0
	Processor count: 4
	64-Bit OS: True
	64-Bit Process: True
	Program data path: /var/lib/emby-server
	Mono: 4.4.2 (Stable 4.4.2.11/f72fe45 Tue Aug 30 15:47:09 UTC 2016)
	Application Path: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe
	Unable to write data to the transport connection: The socket has been shut down.
	System.IO.IOException
	  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32 offset, Int32 size) <0x41df1a80 + 0x0027b> in <filename unknown>:0 
	  at SocketHttpListener.Net.ResponseStream.InternalWrite (System.Byte[] buffer, Int32 offset, Int32 count) <0x41df19d0 + 0x0008f> in <filename unknown>:0 
	  at SocketHttpListener.Net.ResponseStream.Write (System.Byte[] buffer, Int32 offset, Int32 count) <0x41df0880 + 0x001c3> in <filename unknown>:0 
	  at ServiceStack.Formats.HtmlFormat.SerializeToStream (IRequest req, System.Object response, IResponse res) <0x420cca60 + 0x00cd8> in <filename unknown>:0 
	  at ServiceStack.HttpResponseExtensionsInternal.WriteErrorToResponse (IResponse httpRes, IRequest httpReq, System.String contentType, System.String operationName, System.String errorMessage, System.Exception ex, Int32 statusCode) <0x420e47e0 + 0x00213> in <filename unknown>:0 
	  at ServiceStack.ServiceStackHost.HandleUncaughtException (IRequest httpReq, IResponse httpRes, System.String operationName, System.Exception ex) <0x420e46a0 + 0x0011f> in <filename unknown>:0 
	  at ServiceStack.HostContext.RaiseAndHandleUncaughtException (IRequest httpReq, IResponse httpRes, System.String operationName, System.Exception ex) <0x420e4500 + 0x00077> in <filename unknown>:0 
	  at ServiceStack.HttpResponseExtensionsInternal.HandleResponseWriteException (System.Exception originalEx, IRequest request, IResponse response, System.String defaultContentType) <0x420e42e0 + 0x0005b> in <filename unknown>:0 
	  at ServiceStack.HttpResponseExtensionsInternal+<WriteToResponse>d__6.MoveNext () <0x41deb520 + 0x018af> in <filename unknown>:0 
	--- End of stack trace from previous location where exception was thrown ---
	  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f9ee11bd2a0 + 0x00029> in <filename unknown>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f9ee11bb170 + 0x000a7> in <filename unknown>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f9ee11bb0f0 + 0x0006b> in <filename unknown>:0 
	  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f9ee11bb0a0 + 0x0003a> in <filename unknown>:0 
	  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () <0x7f9ee14b1140 + 0x00012> 25569 in <filename unknown>:0 
	  at ServiceStack.Host.RestHandler+<ProcessRequestAsync>d__13.MoveNext () <0x41dda6b0 + 0x011b7> in <filename unknown>:0 
	InnerException: System.Net.Sockets.SocketException
	The socket has been shut down
	  at System.Net.Sockets.Socket.Send (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) <0x41df1e70 + 0x000e3> in <filename unknown>:0 
	  at System.Net.Sockets.NetworkStream.Write (System.Byte[] buffer, Int32 offset, Int32 size) <0x41df1a80 + 0x000b3> in <filename unknown>:0 
	
2016-10-03 17:28:51.5913 Info HttpServer: HTTP Response 500 to 192.168.0.210. Time: 1488ms (slow). http://server.lan:8096/emby/videos/a9b589c6898158e98e3c63f242f82fc6/stream.mp4?DeviceId=159981806e8d66a50688bc9eb941f09bd5172e1a&MediaSourceId=a9b589c6898158e98e3c63f242f82fc6&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=1808000&AudioBitrate=192000&MaxAudioChannels=6&StartTimeTicks=412191150&Level=41&Profile=high&PlaySessionId=6aeee5b6d9a348ac95d42a570675805e&CopyTimestamps=false&EnableSubtitlesInManifest=false&Tag=04ad89f62440722c7cd64f762aad5f07

Any Ideas?

Link to comment
Share on other sites

That generally means the client video player disconnected because it saw something it didn't  like.

Link to comment
Share on other sites

So what can I do to fix this? Open an issue on github for that?

 

As I said ffmpeg is trasncoding the files with the exact same command, and vaapi is beeing used for that. Could it be my browser?

Edited by brrzba
Link to comment
Share on other sites

I did, it is working flawlessly, the thing is I need Hardware Acceleration for transcoding 1080p movies, my CPU alone is too weak for that. But I guess I have to decide..

 

Either beeing able to watch most of the movies, not the 1080p ones I have to transcode, or beeing able to play some of them, but not all because it seems that not all codecs are supported with VAAPI. Or is there something else I could do?

Link to comment
Share on other sites

mastrmind11

I did, it is working flawlessly, the thing is I need Hardware Acceleration for transcoding 1080p movies, my CPU alone is too weak for that. But I guess I have to decide..

 

Either beeing able to watch most of the movies, not the 1080p ones I have to transcode, or beeing able to play some of them, but not all because it seems that not all codecs are supported with VAAPI. Or is there something else I could do?

Install Ubuntu 16.04 instead of Debian and the ffmpeg build from the other post about vaapi.  It works great in that distro.

Link to comment
Share on other sites

Install Ubuntu 16.04 instead of Debian and the ffmpeg build from the other post about vaapi.  It works great in that distro.

I have some other services running on this server, so I cant just switch OS, but perhaps I can run Ubuntu inside of an container. Or the more important question would be, can I have vaapi support inside of that container? Will try that eventually :)

By other ffmpeg build you mean this? https://johnvansickle.com/ffmpeg/

Thank you anyways!

Link to comment
Share on other sites

mastrmind11

I have some other services running on this server, so I cant just switch OS, but perhaps I can run Ubuntu inside of an container. Or the more important question would be, can I have vaapi support inside of that container? Will try that eventually :)

By other ffmpeg build you mean this? https://johnvansickle.com/ffmpeg/

Thank you anyways!

No, the one mentioned here:  http://ubuntuhandbook.org/index.php/2016/09/install-ffmpeg-3-1-ubuntu-16-04-ppa/

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...