egandt 3 Posted June 28, 2016 Posted June 28, 2016 (edited) Located the cause, the GT730 I have is an 108, but only the 110's have NVENC support, looks like I need a different card. Getting a 950 to do this now. ERIC Edited June 28, 2016 by egandt
egandt 3 Posted June 29, 2016 Posted June 29, 2016 (edited) The Wiki seems out of date https://github.com/MediaBrowser/Emby/wiki/GPU-Transcoding as says to look for and edit :<H264Encoder>libx264</H264Encoder> however the current encoding.xml in the latest release looks like: <?xml version="1.0"?> <EncodingOptions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <EncodingThreadCount>-1</EncodingThreadCount> <TranscodingTempPath>/websites/emby_data/temp</TranscodingTempPath> <DownMixAudioBoost>2</DownMixAudioBoost> <EnableDebugLogging>false</EnableDebugLogging> <EnableThrottling>true</EnableThrottling> <ThrottleDelaySeconds>180</ThrottleDelaySeconds> <HardwareAccelerationType /> </EncodingOptions> The parameter: <H264Encoder> is missing. I also see "libx264" in no file (other than man pages), so it did not move. I did see that if I select QuickSync , the file is changed: <HardwareAccelerationType>qsv</HardwareAccelerationType> Does this mean to use nvenc I have set it to "libnvenc" or "nvenc", or something else? I noticed trying either of the above options, results in the line in the browser being blank. Thanks, ERIC FYI: Working on instructions for both QUickSync and NVENC for Ubuntu 16.04 will post once I can properly test. Edited June 29, 2016 by egandt
Luke 42077 Posted June 29, 2016 Posted June 29, 2016 Hi, yea it's out of date because you can enable QSV directly in the web ui now, no need to edit config files.
egandt 3 Posted June 29, 2016 Posted June 29, 2016 (edited) Based off what I've saw in the code it should be "libnvenc", can you confirm that, my only confusion is that the value in the file is "qsv", but in the code it is still "h264_qsv". Also while at it the code is very clean and easy to read. I've tried both libnevnc and nevnc however I still get,something like: <HardwareAccelerationType>libnvenc</HardwareAccelerationType> as well as: <HardwareAccelerationType>nvenc</HardwareAccelerationType> {"Protocol":"File","Id":"8609889eb7dcbf196c57c92dc5d1bd39","Path":"XXXXXXXXXX.mkv","Type":"Default","Container":"mkv","Name":"1080P/H264/DTS","RunTimeTicks":55600640000,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"RequiresOpening":false,"RequiresClosing":false,"VideoType":"VideoFile","MediaStreams":[{"Codec":"h264","Language":"eng","NalLengthSize":"4","IsInterlaced":false,"IsAVC":true,"BitRate":11811720,"BitDepth":8,"RefFrames":5,"IsDefault":true,"IsForced":false,"Height":800,"Width":1920,"AverageFrameRate":23.97602,"RealFrameRate":23.97602,"Profile":"High","Type":"Video","AspectRatio":"2.40:1","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":41,"IsAnamorphic":false},{"Codec":"dca","Language":"eng","DisplayTitle":"Eng DTS 5.1 (D)","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},{"Codec":"srt","Language":"eng","DisplayTitle":"eng srt (D)","IsInterlaced":false,"IsDefault":true,"IsForced":false,"Type":"Subtitle","Index":2,"IsExternal":false,"IsTextSubtitleStream":true,"SupportsExternalStream":true,"Level":0}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":11811720,"RequiredHttpHeaders":{}} /websites/emby_data/ffmpeg/bin/ffmpeg -ss 00:06:29.204 -fflags +genpts -i file:"XXXXXXXXXX.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 libx264 -force_key_frames expr:gte(t,n_forced*5) -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2" -pix_fmt yuv420p -preset superfast -crf 23 -b:v 1680000 -maxrate 1680000 -bufsize 3360000 -vsync vfr -profile:v high -level 41 -map_metadata -1 -threads 0 -codec:a:0 aac -strict experimental -ac 6 -ab 320000 -af "aresample=async=1" -f mp4 -movflags frag_keyframe+empty_moov -y "/websites/emby_data/temp/transcoding-temp/b5483222796f4274834e62ff1e55aa39.mp4" ffmpeg version N-80695-g8fb92ea Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2.1) 20160413 configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-libmfx --enable-cuda --enable-nvenc --enable-gcrypt --enable-avisynth --enable-gcrypt --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libpulse --enable-librtmp --enable-libssh --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-opengl --enable-openssl --enable-libvpx --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-libwebp --prefix=/websites/emby_data/ffmpeg --incdir=/opt/intel/mediasdk/include/mfx libavutil 55. 26.100 / 55. 26.100 libavcodec 57. 48.100 / 57. 48.100 libavformat 57. 40.101 / 57. 40.101 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 46.102 / 6. 46.102 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, matroska,webm, from 'file:XXXXXXXXXX.mkv': Metadata: encoder : libebml v1.3.0 + libmatroska v1.4.0 creation_time : 2013-10-25 14:36:40 Duration: 01:32:40.06, start: 0.000000, bitrate: 11811 kb/s Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709/unknown/unknown), 1920x800 [SAR 1:1 DAR 12:5], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default) Stream #0:2(eng): Subtitle: subrip (default) [libx264 @ 0x26ea640] using SAR=399/400 [libx264 @ 0x26ea640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x26ea640] profile High, level 4.1 [libx264 @ 0x26ea640] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1680 vbv_bufsize=3360 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00 [mp4 @ 0x2791f60] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Last message repeated 1 times Output #0, mp4, to '/websites/emby_data/temp/transcoding-temp/b5483222796f4274834e62ff1e55aa39.mp4': Metadata: encoder : Lavf57.40.101 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x532 [SAR 399:400 DAR 12:5], q=-1--1, 1680 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default) Metadata: encoder : Lavc57.48.100 libx264 Side data: cpb: bitrate max/min/avg: 1680000/0/1680000 buffer size: 3360000 vbv_delay: -1 Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, fltp, 320 kb/s (default) Metadata: encoder : Lavc57.48.100 aac Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (dts (dca) -> aac (native)) Press [q] to stop, [?] for help frame= 32 fps=0.0 q=27.0 size= 1kB time=00:00:01.83 bitrate= 5.4kbits/s speed=3.67x frame= 97 fps= 97 q=25.0 size= 1kB time=00:00:04.54 bitrate= 2.2kbits/s speed=4.54x frame= 174 fps=116 q=27.0 size= 1417kB time=00:00:07.68 bitrate=1511.4kbits/s speed=5.12x Where it is using the software decoder (libx264) and not the nvenc decoder, which I have tested and is working. It appears based on teh code that the issue may be that it is simply not getting called. It seems to me based on quickly pocking around at the code that the problem is in EncodingJobFactory.cs where I see: internal static string GetH264Encoder(EncodingJob state, EncodingOptions options) { if (string.Equals(options.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase)) { // It's currently failing on live tv if (state.RunTimeTicks.HasValue) { return "h264_qsv"; } } return "libx264"; } Which seems to ignore the libnevnc I'll set. Actually the entire list seems to be: MediaBrowser.Server.Mono/bin/Release Mono/dashboard-ui/encodingsettings.html MediaBrowser.WebDashboard/dashboard-ui/encodingsettings.html MediaBrowser.Server.Startup.Common/FFMpeg/FFmpegValidator.cs MediaBrowser.Api/Playback/BaseStreamingService.cs MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs working on a custom compile. Thanks, ERIC Edited June 30, 2016 by egandt
egandt 3 Posted June 30, 2016 Posted June 30, 2016 (edited) Attached are instructions on compiling ffmpeg using both quicksync and nvenc on unbuntu 16.04, this took a bit of time and effort to do as I had to work from multiple sources and I had to reproduce the steps for this guide from my notes, so I hope I left nothing out, but it should help anyone wanting hardware accelerated encoding with ffmpeg. ERIC Updates: First: nvenc should now work in the dev builds, it does not work in the released branch as options have changed, if you want to use nvenc you need to use dev. Second: I suggest pulling the 3.1 branch of ffmpeg for nvenc support and not the 3.0.2 branch as there are a number of improvements affecting Nvidia cards in 3.1, simply use the command: "git clone --branch release/3.1 https://github.com/FFmpeg/FFmpeg"to grab ffmpeg source. qvs_nvenc.txt Edited July 1, 2016 by egandt
Luke 42077 Posted June 30, 2016 Posted June 30, 2016 Hi @@egandt, thanks for the information, I will make the coding changes.
Luke 42077 Posted June 30, 2016 Posted June 30, 2016 Ok, I'm changing this so that you can manually change the xml config file to libnvenc I don't think this is ready to go in the UI yet since it requires users to bring their own ffmpeg with the proper codecs compiled in.
Luke 42077 Posted June 30, 2016 Posted June 30, 2016 In related news: http://emby.media/community/index.php?/topic/36227-h264-omx-instead-of-x264/&do=findComment&comment=342745
peergynt 1 Posted July 3, 2016 Posted July 3, 2016 (edited) Ok, I'm changing this so that you can manually change the xml config file to libnvenc I don't think this is ready to go in the UI yet since it requires users to bring their own ffmpeg with the proper codecs compiled in. Luke, do I need to switch to the beta branch to be able to do this? I just ran into the same problem as @@egandt. I compiled ffmpeg with nvenc, and all tests are go. I just need to pass libnvenc parameter to ffmpeg. EDIT: I got it to work by switching to the beta branch. Note, I'm getting an error with the flag -preset high-performance transcoding log gives me: [h264_nvenc @ 0x23a0d00] [Eval @ 0x7fff8632f7d0] Undefined constant or missing '(' in 'high-performance' [h264_nvenc @ 0x23a0d00] Unable to parse option value "high-performance" [h264_nvenc @ 0x23a0d00] Error setting option preset to value high-performance. Listed in ffmpeg -h encoder=nvenc_h264 is no preset high-performance. I will make a pull request on github. Not sure which profile to use. I am going to stay with default. EDIT2: Ok submitted a pull request to the dev branch. preset "default" is chosen for now. I assume some testing would have to be done to determine the best preset for emby transcoding. The available presets are: -preset <int> E..V.... Set the encoding preset (from 0 to 11) (default medium) default E..V.... slow E..V.... hq 2 passes medium E..V.... hq 1 pass fast E..V.... hp 1 pass hp E..V.... hq E..V.... bd E..V.... ll E..V.... low latency llhq E..V.... low latency hq llhp E..V.... low latency hp lossless E..V.... losslesshp E..V.... Edited July 4, 2016 by peergynt
peergynt 1 Posted July 4, 2016 Posted July 4, 2016 Luke, thanks for putting the changes quickly into the PPA. I had trouble installing it manually with the changes. Works like a charm! I will look into various presets for speed and quality and see if any would fit Emby better (matching the high performance preset that was used w/o nvenc). 1
peergynt 1 Posted July 5, 2016 Posted July 5, 2016 Hmm, I seem to still be getting high CPU usage with transcoding using nvenc in Emby. I don't recall that being an issue when running ffmpeg using nvenc on a test file. Has anyone else encountered this? I'll try to run some tests and see what's causing it.
witteschnitte 7 Posted July 5, 2016 Author Posted July 5, 2016 (edited) @@Luke Hi, you re-enabled h264_qsv in the beta 3.1.43 for decondig. after that quicksync runs very fine. now i update emby and what do i see? It does not work anymore. the decoding part from quicksync transconding is missing in the transcoding log and my cpu gets burned again. Whats happend? regards Felix Edit: I found it!!! The media have to be tagged to use the decoding part. for Some reasons emby forgot the hole media library 5 times in the last month. Regards Edited July 5, 2016 by witteschnitte
MSattler 390 Posted July 5, 2016 Posted July 5, 2016 @@Luke Hi, you re-enabled h264_qsv in the beta 3.1.43 for decondig. after that quicksync runs very fine. now i update emby and what do i see? It does not work anymore. the decoding part from quicksync transconding is missing in the transcoding log and my cpu gets burned again. Whats happend? regards Felix Edit: I found it!!! The media have to be tagged to use the decoding part. for Some reasons emby forgot the hole media library 5 times in the last month. Regards What do you mean it has to be tagged? Tagged as what?
witteschnitte 7 Posted July 5, 2016 Author Posted July 5, 2016 (edited) it has to be tagged in the library with media Info. But there is a other Problem! @@Luke in the beta 3.1.43 everything works fine. In the New stable Release quicksync seeking does not work anymore. Also quality switch will abort the Video. What is going wrong since the beta and this final Release? Ok found out that only the emby android app will not work with quicksync. Browser and kodi works. So for me its fine! Edited July 5, 2016 by witteschnitte
digriz 0 Posted July 5, 2016 Posted July 5, 2016 (edited) Is there any way someone can send me a link to a compiled FFMPEG bin package that has nvenc compiled into it? for x64/x32 windows? I got the zeranoe one and im not having any luck. Edited July 5, 2016 by digriz
Luke 42077 Posted July 5, 2016 Posted July 5, 2016 it has to be tagged in the library with media Info. But there is a other Problem! @@Luke in the beta 3.1.43 everything works fine. In the New stable Release quicksync seeking does not work anymore. Also quality switch will abort the Video. What is going wrong since the beta and this final Release? Ok found out that only the emby android app will not work with quicksync. Browser and kodi works. So for me its fine! If you're having an issue, please make sure to see how to report a problem. Thanks.
kfraleigh 0 Posted July 5, 2016 Posted July 5, 2016 Is there any way someone can send me a link to a compiled FFMPEG bin package that has nvenc compiled into it? for x64/x32 windows? I got the zeranoe one and im not having any luck. The latest build is compiled with -enable nvenc. It shows as enabled in the log file for emby server, but won't work for me either with a gtx960. I have to set hardware acceleration to "none" for transcoding to work.
Luke 42077 Posted July 5, 2016 Posted July 5, 2016 The latest build is compiled with -enable nvenc. It shows as enabled in the log file for emby server, but won't work for me either with a gtx960. I have to set hardware acceleration to "none" for transcoding to work. Hi, please see post #692, thanks.
digriz 0 Posted July 5, 2016 Posted July 5, 2016 The latest build is compiled with -enable nvenc. It shows as enabled in the log file for emby server, but won't work for me either with a gtx960. I have to set hardware acceleration to "none" for transcoding to work. Same thing here. Thanks for the reply however.
dark_slayer 103 Posted July 6, 2016 Posted July 6, 2016 Ok found out that only the emby android app will not work with quicksync. Browser and kodi works Hmm, Emby for Android -sigh-
kfraleigh 0 Posted July 7, 2016 Posted July 7, 2016 nvenc works for me since last beta update. There was an error in the log file still, but it played over web interface, emby theater, and iOS app. I'll try to post it later. Just wanted to give quick feedback that it was working. Thanks!
Luke 42077 Posted July 8, 2016 Posted July 8, 2016 With the new stable release rolling out this is really a treat for all fans of GPU transcoding. Not only has the QSV decoding been restored, but experimental support of HEVC and OMX has also been added (requires compatible hardware + ffmpeg). Enjoy.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now