Jump to content

GPU Transcoding (Intel QuickSync and nVidia NVENC)


witteschnitte

Recommended Posts

Hi,

I can't find ffmpeg with QuickSync enabled for Linux. Is this feature enabled on Linux ? I have Intel supported CPU.

Do I need only dev server, or I can test it on stable Version 3.0.5607.2 ? (of course, with compatible ffmpeg+qs)

I just created an account to get to know more about this!

 

Any news on QuicSync for Linux?

 

EDIT:

Cloned the latest ffmpeg git and it's there:

[zao@nuc FFmpeg]$ ./configure --list-encoders | grep qs
h264_qsv                pcm_s16be_planar        wmav1

When compiled, it doesn't work; I don't know why:

[zao@nuc Season 05]$ ffmpeg -i "file.mkv" -b:v 4000k -vcodec h264_qsv "output.mp4"
ffmpeg version N-73010-gbb3703a Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.1.0 (GCC)
  configuration: --prefix=/usr --shlibdir=/usr/lib --disable-static --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-shared --enable-x11grab --enable-encoder=h264_qsv
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 37.100 / 56. 37.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'file.mkv':
  Metadata:
    encoder         : mkv2rls x264-tv version built on 2015. febr. 22
  Duration: 01:02:04.18, start: 0.000000, bitrate: 2506 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s (default)
    Stream #0:2(eng): Subtitle: subrip (default)
    Metadata:
      title           : English
Unknown encoder 'h264_qsv'

This is on Arch Linux btw.

 

Any ideas?

 

Edited by zao
Link to comment
Share on other sites

mitsumaui

Have to say this feature has been impressively good! Am running this on a I7-2630QM. Had 3 x 1080P streams transcoding down to 720p 1.5mbps handled just fine by QuickSync. Peaked around 80% of the GPU. Keep up the awesome work!

 

That said, I did come across an MKV which did not play nice. Wanted to post the log here for someone to review :) Hopefully an easy fix!

 

http://xxxxxx:8096/mediabrowser/videos/4a039bfed4d83a13ed1d9bde7d4add3c/hlsdynamic/main/0.ts?DeviceId=1MM53S032127&MediaSourceId=4a039bfed4d83a13ed1d9bde7d4add3c&VideoCodec=h264&AudioCodec=aac&AudioStreamIndex=1&VideoBitrate=3372000&AudioBitrate=128000&MaxAudioChannels=2&MaxFramerate=30&MaxWidth=1920&MaxHeight=1080&Level=41&ClientTime=635706874620404956&MaxRefFrames=8&MaxVideoBitDepth=8&Profile=high&PlaySessionId=772f04a14a204c83902c7f183516f788&api_key=9a57214063ce46e6b7bbe534634354dd

{"Protocol":"File","Id":"4a039bfed4d83a13ed1d9bde7d4add3c","Path":"\\\\server\\data\\movies\\Avatar\\Avatar.mkv","Type":"Default","Container":"mkv","Size":8688467425,"Name":"720P/H264/DTS","RunTimeTicks":97016530000,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"RequiresOpening":false,"RequiresClosing":false,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","IsInterlaced":false,"BitRate":7164525,"BitDepth":8,"IsDefault":true,"IsForced":false,"Height":946,"Width":1680,"AverageFrameRate":23.97602,"RealFrameRate":23.97602,"Profile":"High","Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":51,"IsAnamorphic":false},{"Codec":"dca","IsInterlaced":false,"ChannelLayout":"5.1","BitRate":1536000,"Channels":6,"SampleRate":48000,"IsDefault":true,"IsForced":false,"Profile":"DTS","Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0}],"PlayableStreamFileNames":[],"Formats":["mkv","webm"],"Bitrate":7164525,"RequiredHttpHeaders":{}}

C:\Users\Jason\AppData\Roaming\Emby-Server\ffmpeg\20150331\ffmpeg.exe -i file:"\\server\data\movies\Avatar\Avatar.mkv" -map_metadata -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -pix_fmt yuv420p -preset 7 -b:v 3372000 -maxrate (3372000*1.2) -bufsize (3372000*2) -vsync vfr -profile:v high -level 4.1 -force_key_frames expr:gte(t,n_forced*3) -vf "scale=trunc(min(max(iw\,ih*dar)\,min(1920\,1080*dar))/2)*2:trunc(min(max(iw/dar\,ih)\,min(1920/dar\,1080))/2)*2:flags=fast_bilinear" -flags +loop-global_header -sc_threshold 0 -codec:a:0 aac -strict experimental -ac 2 -ab 128000 -af "adelay=1,aresample=async=1,volume=2" -hls_time 3 -start_number 0 -hls_list_size 0 -y "C:\Users\Jason\AppData\Roaming\Emby-Server\transcoding-temp\191f0a416351ca7e3138c1ef93fd67ca.m3u8"


ffmpeg version N-68994-g713e3bb Copyright © 2000-2015 the FFmpeg developers
built on Jan 14 2015 19:47:03 with gcc 4.9.2 (Rev2, Built by MSYS2 project)
configuration: --enable-libmfx --enable-libnvenc --enable-nonfree --enable-iconv --arch=x86 --disable-debug --disable-shared --disable-doc --disable-w32threads --enable-gpl --enable-version3 --enable-runtime-cpudetect --enable-avfilter --enable-bzlib --enable-zlib --enable-decklink --enable-librtmp --enable-gnutls --enable-avisynth --enable-frei0r --enable-filter=frei0r --enable-libbluray --enable-libcaca --enable-libopenjpeg --enable-fontconfig --enable-libfreetype --enable-libass --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libsoxr --enable-libtwolame --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvorbis --enable-libvo-aacenc --enable-libopus --enable-libvidstab --enable-libvpx --enable-libwavpack --enable-libxavs --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi
libavutil 54. 16.100 / 54. 16.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 18.100 / 56. 18.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 7.100 / 5. 7.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, matroska,webm, from 'file:\\server\data\movies\Avatar\Avatar.mkv':
Metadata:
title : RED_BIRD_2D_WW.Title852.BlurayRip
encoder : libebml v0.7.8 + libmatroska v0.8.1
creation_time : 2011-03-20 19:45:48
Duration: 02:41:41.65, start: 0.000000, bitrate: 7164 kb/s
Chapter #0:0: start 0.000000, end 377.960000
Metadata:
title : (01)00:00:00:000
Chapter #0:1: start 377.960000, end 473.598000
Metadata:
title : (02)00:06:17:960
Chapter #0:2: start 473.598000, end 724.890000
Metadata:
title : (03)00:07:53:598
Chapter #0:3: start 724.890000, end 840.464000
Metadata:
title : (04)00:12:04:890
Chapter #0:4: start 840.464000, end 1200.574000
Metadata:
title : (05)00:14:00:464
Chapter #0:5: start 1200.574000, end 1440.230000
Metadata:
title : (06)00:20:00:574
Chapter #0:6: start 1440.230000, end 1613.278000
Metadata:
title : (07)00:24:00:230
Chapter #0:7: start 1613.278000, end 1901.899000
Metadata:
title : (08)00:26:53:278
Chapter #0:8: start 1901.899000, end 2013.428000
Metadata:
title : (09)00:31:41:899
Chapter #0:9: start 2013.428000, end 2143.849000
Metadata:
title : (10)00:33:33:428
Chapter #0:10: start 2143.849000, end 2611.859000
Metadata:
title : (11)00:35:43:849
Chapter #0:11: start 2611.859000, end 2963.627000
Metadata:
title : (12)00:43:31:859
Chapter #0:12: start 2963.627000, end 3269.974000
Metadata:
title : (13)00:49:23:627
Chapter #0:13: start 3269.974000, end 3596.050000
Metadata:
title : (14)00:54:29:974
Chapter #0:14: start 3596.050000, end 3910.197000
Metadata:
title : (15)00:59:56:050
Chapter #0:15: start 3910.197000, end 4296.417000
Metadata:
title : (16)01:05:10:197
Chapter #0:16: start 4296.417000, end 4511.006000
Metadata:
title : (17)01:11:36:417
Chapter #0:17: start 4511.006000, end 4829.115000
Metadata:
title : (18)01:15:11:006
Chapter #0:18: start 4829.115000, end 5081.910000
Metadata:
title : (19)01:20:29:115
Chapter #0:19: start 5081.910000, end 5764.800000
Metadata:
title : (20)01:24:41:910
Chapter #0:20: start 5764.800000, end 5875.786000
Metadata:
title : (21)01:36:04:800
Chapter #0:21: start 5875.786000, end 6273.099000
Metadata:
title : (22)01:37:55:786
Chapter #0:22: start 6273.099000, end 6495.488000
Metadata:
title : (23)01:44:33:099
Chapter #0:23: start 6495.488000, end 6833.868000
Metadata:
title : (24)01:48:15:488
Chapter #0:24: start 6833.868000, end 6932.884000
Metadata:
title : (25)01:53:53:868
Chapter #0:25: start 6932.884000, end 7118.819000
Metadata:
title : (26)01:55:32:884
Chapter #0:26: start 7118.819000, end 7325.568000
Metadata:
title : (27)01:58:38:819
Chapter #0:27: start 7325.568000, end 7533.859000
Metadata:
title : (28)02:02:05:568
Chapter #0:28: start 7533.859000, end 7801.835000
Metadata:
title : (29)02:05:33:859
Chapter #0:29: start 7801.835000, end 8167.283000
Metadata:
title : (30)02:10:01:835
Chapter #0:30: start 8167.283000, end 8390.840000
Metadata:
title : (31)02:16:07:283
Chapter #0:31: start 8390.840000, end 8750.324000
Metadata:
title : (32)02:19:50:840
Chapter #0:32: start 8750.324000, end 9074.064000
Metadata:
title : (33)02:25:50:324
Chapter #0:33: start 9074.064000, end 9305.295000
Metadata:
title : (34)02:31:14:064
Chapter #0:34: start 9305.295000, end 9700.690000
Metadata:
title : (35)02:35:05:295
Chapter #0:35: start 9700.690000, end 9701.653325
Metadata:
title : (36)02:41:40:690
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1680x946, SAR 1:1 DAR 840:473, 23.98 fps, 23.98 tbr, 48003.07 tbn, 47.95 tbc (default)
Stream #0:1: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Incompatible pixel format 'yuv420p' for codec 'h264_qsv', auto-selecting format 'nv12'
[h264_qsv @ 01084dc0] MFXVideoENCODE_Init(): 5
Output #0, hls, to 'C:\Users\Jason\AppData\Roaming\Emby-Server\transcoding-temp\191f0a416351ca7e3138c1ef93fd67ca.m3u8':
Chapter #0:0: start 0.000000, end 377.960000
Chapter #0:1: start 377.960000, end 473.598000
Chapter #0:2: start 473.598000, end 724.890000
Chapter #0:3: start 724.890000, end 840.464000
Chapter #0:4: start 840.464000, end 1200.574000
Chapter #0:5: start 1200.574000, end 1440.230000
Chapter #0:6: start 1440.230000, end 1613.278000
Chapter #0:7: start 1613.278000, end 1901.899000
Chapter #0:8: start 1901.899000, end 2013.428000
Chapter #0:9: start 2013.428000, end 2143.849000
Chapter #0:10: start 2143.849000, end 2611.859000
Chapter #0:11: start 2611.859000, end 2963.627000
Chapter #0:12: start 2963.627000, end 3269.974000
Chapter #0:13: start 3269.974000, end 3596.050000
Chapter #0:14: start 3596.050000, end 3910.197000
Chapter #0:15: start 3910.197000, end 4296.417000
Chapter #0:16: start 4296.417000, end 4511.006000
Chapter #0:17: start 4511.006000, end 4829.115000
Chapter #0:18: start 4829.115000, end 5081.910000
Chapter #0:19: start 5081.910000, end 5764.800000
Chapter #0:20: start 5764.800000, end 5875.786000
Chapter #0:21: start 5875.786000, end 6273.099000
Chapter #0:22: start 6273.099000, end 6495.488000
Chapter #0:23: start 6495.488000, end 6833.868000
Chapter #0:24: start 6833.868000, end 6932.884000
Chapter #0:25: start 6932.884000, end 7118.819000
Chapter #0:26: start 7118.819000, end 7325.568000
Chapter #0:27: start 7325.568000, end 7533.859000
Chapter #0:28: start 7533.859000, end 7801.835000
Chapter #0:29: start 7801.835000, end 8167.283000
Chapter #0:30: start 8167.283000, end 8390.840000
Chapter #0:31: start 8390.840000, end 8750.324000
Chapter #0:32: start 8750.324000, end 9074.064000
Chapter #0:33: start 9074.064000, end 9305.295000
Chapter #0:34: start 9305.295000, end 9700.690000
Chapter #0:35: start 9700.690000, end 9701.653325
Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 23.98 fps (default)
Metadata:
encoder : Lavc56.20.100 h264_qsv
Stream #0:1: Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
encoder : Lavc56.20.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (dts (dca) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Link to comment
Share on other sites

  • 4 weeks later...

The next Emby Server release will update to ffmpeg 2.7.1 which now has a number of hardware acceleration feature. If anyone is familiar with them I could use some help so please let me know. We can start to take advantage of these features, we just need to learn about them first.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

I cant seem to find the GPU transcoding Wiki page any more? The link seem dead on Github.

 

Any reasons for that? Would very much like to offload my CPU.

 

//TjaLfE

Link to comment
Share on other sites

Tranquil

I have an nvidia and an Intel gpu on one machine, so I can check both methods. Just tell me what to do.

 

Gesendet von meinem GT-I9506 mit Tapatalk

Link to comment
Share on other sites

Not by me but it doesn't matter. It was not working anymore anyway because the original contributor hasn't updated it for newer server releases. see post #280

Link to comment
Share on other sites

Oh.. that's sad :(

 

This was really a thing that made Emby have the upper hand over Plex(At least that's my oppinion). I hope some one will be able to get it working again with the new ffmpeg.

Sadly i'm not skilled enough to help out my self :( I would if i could :)

Link to comment
Share on other sites

As Luke has statet out here http://emby.media/community/index.php?/topic/10723-gpu-transcoding-intel-quicksync-and-nvidia-nvenc/page-14&do=findComment&comment=229005

there may be a native hardware acceleration in Emby soon. So no need for 3rd party hacks.

Hi,

 

I'm aware of that post by Luke, as he pointed to it.

Seems he needs assistance in getting it to work, or at least get i to work faster. I'm sure that Luke will eventually get i working, but probably have alot of work on his desk :)

 

Untill it's back, CPU transcoding will do.

 

Another little side question. If i set the client to 30Mbps, and the movis is only 20Mbps, will it then use Transcoding to upscale the movie? or will it just use direct play?

 

//Tjalfe

Link to comment
Share on other sites

Another little side question. If i set the client to 30Mbps, and the movis is only 20Mbps, will it then use Transcoding to upscale the movie? or will it just use direct play?

 

We don't upscale anything.  All the settings are max values.

Link to comment
Share on other sites

The server has that version but we haven't started taking advantage of it yet. I'm hoping for some community help researching it

  • Like 1
Link to comment
Share on other sites

babgvant

The server has that version but we haven't started taking advantage of it yet. I'm hoping for some community help researching it

 

The one on my server didn't list h264_qsv in its encoder list. Are you building it yourself? The pre-built one I usually use pulled support due to issues with WinXP.

Link to comment
Share on other sites

babgvant

For windows we get it from zeranoe

 

It was pulled.

 

If you run ffmpeg.exe -encoders it will provide the same list I attached (which doesn't have qsv).

Edited by babgvant
Link to comment
Share on other sites

babgvant

Built a recent version of ffmpeg w/ h264_qsv support. Has anyone been able to get it working on a server OS?

 

Had to install an older driver to get Intel Quick Sync working on the Windows 2012R2 box.

 

Anyone else struggling with this make sure that there are keys corresponding to your generation of CPU in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intel\MediaSDK\Dispatch.

 

IVB = Ivy Bridge

HSW = Haswell

BDW = Broadwell

SKL = Sky Lake

Link to comment
Share on other sites

babgvant

The server has that version but we haven't started taking advantage of it yet. I'm hoping for some community help researching it

 

What do you need?

Link to comment
Share on other sites

Analysis of our current encoding command lines and what needs to change to utilize the features

Link to comment
Share on other sites

babgvant

Where are these found in the server code?

 

I think we'll probably want to write a utility to test if QS is enabled/installed properly (I can do this) before actually allowing users to enable qsv.

 

If it is, then it should be safe to swap h264|mpeg2|vc1 decoders for *_qsv (where * is the codec) and use "h264_qsv" instead of "h264 for" encoding (there's also a mpeg2_qsv, but...). For systems that support it there are also options for hevc, but that's probably best left unmessed with for now.

Link to comment
Share on other sites

any chance nVidia CUDA can also be utilized - I run Emby on Dell PowerEdge R710's and my CPU's do not have intel integrated gfx however I do have nVidia 750Ti's installed in them for CUDA support (nvenc)

Edited by mbnwa
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...