Jump to content

Recommended Posts

witteschnitte
Posted (edited)

@@Luke

Thank you for your answer.

I searched the emby forum and found that mostly all h264_qsv decoding errors come from a missconfigurated Intel media sdk and ffmpeg.

 

If you leave the leading decoding part quicksync is not working correct but it worked for thouse who had a wrong configuration because quicksync than does not matter. Without decoding part quicksync behave like CPU transcoding. Thats while it worked for wrong configurated systems.

 

Can i manually add this part?

Edited by witteschnitte
witteschnitte
Posted

Can I add the decoding parameter manually??

thelamer
Posted

I am so close I can taste it, I have compiled the the quicksync setup including ffmpeg and when I run it in Emby I am getting: 

[h264_qsv @ 0x293a240] mfx init: /dev/dri/renderD128 fd open failed
[h264_qsv @ 0x293a240] mfx init: /dev/dri/renderD129 fd open failed
[h264_qsv @ 0x293a240] mfx init: /dev/dri/renderD130 fd open failed
[h264_qsv @ 0x293a240] mfx init: /dev/dri/card0 fd open failed
[h264_qsv @ 0x293a240] mfx init: /dev/dri/card1 fd open failed
[h264_qsv @ 0x293a240] mfx init: /dev/dri/card2 fd open failed
[h264_qsv @ 0x293a240] Encoder will work with partial HW acceleration
    Last message repeated 1 times
[h264_qsv @ 0x293a240] Error retrieving encoding parameters.

But when I run the exact same command as root, everything works fine: 

/var/lib/emby-server/ffmpeg/20160215/ffmpeg -fflags +genpts -i file:"/storage/media/Movies/The Do Over 2016.mkv" -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -force_key_frames expr:gte\(t,n_forced*5\) -copyts -avoid_negative_ts disabled -start_at_zero -preset 7 -look_ahead 0 -b:v 3680000 -maxrate 3680000 -bufsize 7360000 -vsync vfr -profile:v high -level 5.1 -map_metadata -1 -threads 0 -codec:a:0 libmp3lame -ac 2 -ab 320000 -af "aresample=async=1,volume=2" -y "/var/lib/emby-server/transcoding-temp/47d5d25e9ad21ded47afbc21a96cc44d.mkv"
ffmpeg version N-80111-gd1520a6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libtheora --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc --prefix=/opt/ffmpeg_qsv/
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 43.100 / 57. 43.100
  libavformat    57. 37.101 / 57. 37.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.100 /  6. 46.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'file:/storage/media/Movies/The Do Over 2016.mkv':
  Metadata:
    title           : The.Do.Over.2016.1080p.NF.WEBRip.DD5.1.x264-PiA
    encoder         : libebml v1.3.3 + libmatroska v1.4.4
    creation_time   : 2016-05-28 03:58:22
  Duration: 01:47:44.38, start: 0.000000, bitrate: 10383 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1920x1036 [SAR 1:1 DAR 480:259], 23.98 fps, 23.98 tbr, 1k tbn (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
    Stream #0:2(eng): Subtitle: subrip (default)
    Stream #0:3(ita): Subtitle: subrip
    Stream #0:4(ger): Subtitle: subrip
    Stream #0:5(por): Subtitle: subrip
    Stream #0:6: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 120x176, 90k tbr, 90k tbn
    Metadata:
      filename        : small_cover.jpg
      mimetype        : image/jpeg
    Stream #0:7: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 213x120, 90k tbr, 90k tbn
    Metadata:
      filename        : small_cover_land.jpg
      mimetype        : image/jpeg
    Stream #0:8: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 600x882, 90k tbr, 90k tbn
    Metadata:
      filename        : cover.jpg
      mimetype        : image/jpeg
    Stream #0:9: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1067x600, 90k tbr, 90k tbn
    Metadata:
      filename        : cover_land.jpg
      mimetype        : image/jpeg
libva info: VA-API version 0.99.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'iHD'
libva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_0_32
libva info: va_openDriver() returns 0
[matroska @ 0x360e0c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, matroska, to '/var/lib/emby-server/transcoding-temp/47d5d25e9ad21ded47afbc21a96cc44d.mkv':
  Metadata:
    encoder         : Lavf57.37.101
    Stream #0:0: Video: h264 (H264 / 0x34363248), nv12, 1920x1036 [SAR 1:1 DAR 480:259], q=2-31, 3680 kb/s, 23.98 fps, 1k tbn (default)
    Metadata:
      encoder         : Lavc57.43.100 h264_qsv
    Side data:
      cpb: bitrate max/min/avg: 3680000/0/3680000 buffer size: 7360000 vbv_delay: -1
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 320 kb/s (default)
    Metadata:
      encoder         : Lavc57.43.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
  Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 1527 fps=238 q=-0.0 Lsize=   31377kB time=00:01:04.15 bitrate=4006.7kbits/s speed=  10x    
video:28838kB audio:2507kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103048%

It seems like the emby process is not linked properly to the IHd driver, I have tried manually exporting the vars in the init script and /etc/default/emby-server, but I get the same results. The enviroment variables in question are in /etc/environment:

LD_LIBRARY_PATH="/usr/local/lib:/usr/lib64"
LIBVA_DRIVER_NAME=iHD
LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
 

Any help would be appreciated. 

witteschnitte
Posted (edited)

did you install the media sdk correct?

are the media sdk Samples running?

look in this thread some Sites ago there is a how to install the media sdk. the media sdk Samples must running.

 

this Site under find a solution.

this worked very nice

 

http://emby.media/community/index.php?/topic/10723-gpu-transcoding-intel-quicksync-and-nvidia-nvenc/page-30

 

 

you also have to add the emby User in the Video group

 

which os you are using? In centos i had trouble to run ffmpeg with sudo. sudo in centos dont get eviroment variables from global.

 

its much more easy in ubuntu.

In ubuntu you dont have to export special variables for emby. it uses the global variables.

But the Group for emby User have to be Set.

you could also test if its working using the command vainfo and look at the driver names

Edited by witteschnitte
thelamer
Posted

did you install the media sdk correct?

are the media sdk Samples running?

look in this thread some Sites ago there is a how to install the media sdk. the media sdk Samples must running.

 

this Site under find a solution.

this worked very nice

 

http://emby.media/community/index.php?/topic/10723-gpu-transcoding-intel-quicksync-and-nvidia-nvenc/page-30

 

 

you also have to add the emby User in the Video group

 

which os you are using? In centos i had trouble to run ffmpeg with sudo. sudo in centos dont get eviroment variables from global.

 

its much more easy in ubuntu.

In ubuntu you dont have to export special variables for emby. it uses the global variables.

But the Group for emby User have to be Set.

you could also test if its working using the command vainfo and look at the driver names

 

Debian. 

 

You were correct, after running:

usermod -a -G video emby

The ffmpeg commands executed from Emby are now working. 

 

Thanks for reading and the suggestions! 

witteschnitte
Posted

You are welcome

witteschnitte
Posted (edited)

@@Luke

 

Are there any internal Tests in the development to find out whether the ffmpeg decoding part is working?

For me its working.

 

Can i help you with this?

I really like to get back the quicksync decoding part in emby ffmpeg.

 

Plesse let me know

Edited by witteschnitte
thelamer
Posted

@@Luke

 

Are there any internal Tests in the development to find out whether the ffmpeg decoding part is working?

For me its working.

 

Can i help you with this?

I really like to get back the quicksync decoding part in emby ffmpeg.

 

Plesse let me know

 

I mean you could uncomment these lines and do a custom build :

 

https://github.com/MediaBrowser/Emby/blob/6af773773d457d6b8feb3ce36186a4e589391352/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs#L382-L386

 

I have never seen a problem when using it for decode too, but I do not pass as complex ffmpeg commands when doing my own encoding tests. 

Deihmos
Posted (edited)

Is quick sync still working ? CPU jumps to near 100% when on and off. It use to be less than 30%

 

Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Edited by Deihmos
Posted

 

Is quick sync still working ? CPU jumps to near 100% when on and off. It use to be less than 30%

 

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

 

 

I really don't know what that means, can you please provide more detail?

 

http://emby.media/community/index.php?/topic/739-how-to-report-a-problem/

 

Also, nobody is making any promises about cpu usage. All we're doing is giving you guys what you wanted, which is utilizing ffmpeg's supported qsv encoders. Whether it uses more or less cpu than the regular encoders is really out of our control.

Deihmos
Posted

I am not sure how the logs will help but see attached. I don't know when it changed but in previous server versions cpu use with intel quick sync was very low but now it makes no difference. 

 

 

 

 

transcode-547621cb-f3a1-4711-883b-6185560315c8.txt

witteschnitte
Posted

This is the Same issue that i had since decoding is missing. As i said if i manually add the decoding Part in the commandline everything works fine again. even the cpu usage

  • Like 1
Posted

Hello,

did it with this tutorial and get this error message when i enter vainfo:

# vainfo
error: can't connect to X server!
libva info: VA-API version 0.99.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

i use ubuntu 14.04 on a Dell PowerEdge T20 - Xeon E3-1225 v3.

 

thanks

Posted

This is the Same issue that i had since decoding is missing. As i said if i manually add the decoding Part in the commandline everything works fine again. even the cpu usage

I think it is what I'm noticing too... high cpu usage since some builds... in fact since I upgraded to the latest stable.

 

How do you test it?

witteschnitte
Posted

I copied the ffmpeg Code from the transcoding log and add after the ffmpeg c:v h264_qsv. this parameter was removed in the last emby versions. if you copy from the log and add as First parameter c:v h264_qsv it works good like before. but only for testing. because without the developers we wount get the parameter back

Posted

Since the vsync change seems to be ok i will enable it again on the testing branches. 

witteschnitte
Posted

thank you Luke. As i said . vsync was the only Problem in quicksync not the decoding Part.

 

looking forwand to the New emby versions

  • 2 weeks later...
Posted (edited)

This doesn't work for me on debian  3.0.5973.0

Streams just fail to open on any kind of transcode.

 

Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2036-02-06 06:28:16
encoder : HandBrake 0.10.2 2015060900
Duration: 01:22:56.68, start: 0.000000, bitrate: 3147 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x804 [sAR 232:231 DAR 37120:15477], 2981 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2036-02-06 06:28:16
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)
Metadata:
creation_time : 2036-02-06 06:28:16
handler_name : Stereo
[h264_qsv @ 0x4e938a0] Error initializing an internal MFX session
Output #0, hls, to '/var/lib/emby-server/transcoding-temp/340f72e95d20b267511ff22c4beaeca1.m3u8':
Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 296960:299691 DAR 0:0, 25 fps (default)
Metadata:
encoder : Lavc57.24.102 h264_qsv
Stream #0:1: Audio: aac, 0 channels, 128 kb/s (default)
Metadata:
encoder : Lavc57.24.102 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

 

I assume [h264_qsv @ 0x4e938a0] Error initializing an internal MFX session is my problem, but I can't seem to figure out why.

 

Edit: seems like I need to patch the kernal to make this work, stuff that. I imagine this is a common wall that Linux users run into, maybe this should have a FAQ page?

Edited by Letters
Happy2Play
Posted

This doesn't work for me on debian  3.0.5973.0

Streams just fail to open on any kind of transcode.

 

Metadata:

major_brand : mp42

minor_version : 512

compatible_brands: isomiso2avc1mp41

creation_time : 2036-02-06 06:28:16

encoder : HandBrake 0.10.2 2015060900

Duration: 01:22:56.68, start: 0.000000, bitrate: 3147 kb/s

Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x804 [sAR 232:231 DAR 37120:15477], 2981 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)

Metadata:

creation_time : 2036-02-06 06:28:16

handler_name : VideoHandler

Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)

Metadata:

creation_time : 2036-02-06 06:28:16

handler_name : Stereo

[h264_qsv @ 0x4e938a0] Error initializing an internal MFX session

Output #0, hls, to '/var/lib/emby-server/transcoding-temp/340f72e95d20b267511ff22c4beaeca1.m3u8':

Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 296960:299691 DAR 0:0, 25 fps (default)

Metadata:

encoder : Lavc57.24.102 h264_qsv

Stream #0:1: Audio: aac, 0 channels, 128 kb/s (default)

Metadata:

encoder : Lavc57.24.102 aac

Stream mapping:

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

Stream #0:1 -> #0:1 (aac (native) -> aac (native))

Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

 

I assume [h264_qsv @ 0x4e938a0] Error initializing an internal MFX session is my problem, but I can't seem to figure out why.

Best guess, do you have the version of ffmpeg?

 

https://trac.ffmpeg.org/ticket/4831

Posted

Best guess, do you have the version of ffmpeg?

 

https://trac.ffmpeg.org/ticket/4831

Thanks for the reply, it seems like I would need to compile my own ffmpeg and patch in the Intel Media SDK in order to get quicksync to work on Debian Jessie? Little too much of a bother for me. It's a bit of a bummer because this was actually why I initially chose Emby over Plex.

 

Unless I'm totally wrong and this should be working out of the box.

  • 2 weeks later...
Posted

I was wondering if I could get some clarification on the two stream limit with NVENC. I don't have an Nvidia GPU to test this, so if someone has some experience with it, that'd be great. If I build ffmpeg with NVENC support, and there are three transcode jobs in Emby, will the third fail or fallback to CPU transcode?

Posted

I was wondering if I could get some clarification on the two stream limit with NVENC. I don't have an Nvidia GPU to test this, so if someone has some experience with it, that'd be great. If I build ffmpeg with NVENC support, and there are three transcode jobs in Emby, will the third fail or fallback to CPU transcode?

 

At the moment we haven't built that kind of fallback no.

Posted

Trying to get NVENC to work, as I had to give up on QuickSync since it does not support the 3XXX series processors (very annoying that), however I had a GT730 (108 chipset) laying around so on to NVENC decoding.

 

First off I'm on Ubuntu 16.04 (so it is very annoying that there are no REPO from Nvidia for this version.

 

I have installed the Nvidia video Drivers (361) and nvidia_video_sdk (version 6.0.1).

 

root@fileserver:~/manual# nvidia-smi
Tue Jun 28 10:17:11 2016       
+------------------------------------------------------+                       
| NVIDIA-SMI 361.42     Driver Version: 361.42         |                       
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 730      Off  | 0000:02:00.0     N/A |                  N/A |
| 65%   31C   P12    N/A /  N/A |     48MiB /  1023MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+
 

 

root@fileserver:~/manual/ffmpeg-3.0.2# lshw -numeric -C display
  *-display               
       description: VGA compatible controller
       product: GF108 [GeForce GT 730] [10DE:F02]
       vendor: NVIDIA Corporation [10DE]
       physical id: 0
       bus info: pci@0000:02:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:33 memory:f6000000-f6ffffff memory:e0000000-e7ffffff memory:e8000000-e9ffffff ioport:e000(size=128) memory:f7000000-f707ffff
 

 

root@fileserver:~/manual/ffmpeg-3.0.2# lsmod | grep nvidia
nvidia_uvm            696320  0
nvidia_modeset        745472  2
nvidia              10076160  43 nvidia_modeset,nvidia_uvm
drm                   360448  8 i915,drm_kms_helper,nvidia
 

 

So the GT 730 is found and configured.  Note root is a member of the group video as I know that is important.

I have compiled ffmpeg 3.02 (GIT master branch), with NVENC support:

ffmpeg version N-80695-g8fb92ea Copyright © 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 --disable-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/ffmpeg --incdir=/opt/intel/mediasdk/include/mfx

 

This compiles fine, however when I try to run ffmpeg using "nvenc_h264" I get a failure:

 

root@fileserver:~/manual/ffmpeg-3.0.2# ./ffmpeg -i test.mkv -c:v h264_nvenc  -preset default output.mp4
ffmpeg version N-80695-g8fb92ea Copyright © 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 --disable-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/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 'test.mkv':
  Metadata:
......... (skipped lines as they are not important)
File 'output.mp4' already exists. Overwrite ? [y/N] Y
[h264_nvenc @ 0x3a49400] No NVENC capable devices found
Output #0, mp4, to 'output.mp4':
........ (skipped lines as they are not important)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height



So basically I have the SDK installed, I have video drivers installed, I have been able to compile support for ffmpeg, but when I try to use ffmpeg I get an error:

[h264_nvenc @ 0x3a49400] No NVENC capable devices found

 

Any suggestions as this is driving me crazy,

ERIC


 

 

 

 

Posted

It says no capable devices found. While I don't know the answer, a good thing to check would be that your video drivers are up to date, and also it's possible you may have to configure your video drivers to allow other apps to use the hardware features. Just a guess though.

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