FAQ  •  Register  •  Login

Howto enable quicksync transcoding Serviio 1.7 / Windows

<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Sat Oct 08, 2016 6:02 pm

Howto enable quicksync transcoding Serviio 1.7 / Windows

Hello to the Serviio Team and this Forum.

I am using Serviio on Windows 10 to serve media files mainly to my Panasonic tv.
Normally I archive videos in h264/aac since the tv can handle them without transcoding.
Since h265 allows for better compression I think about changing to this codec.
My server is using an Intel J3170 CPU which supports quicksync and hw decode of h265 and hw encode
of h264. Software transcode of h265 using the "Panasonic G/GT/DT/UT/VT (2011/2012)" profile
burdens my server to much --> stuttering.

I was looking into the topic but found out that current ffmpeg versions allow using quicksync h264 encode.
Updating the ffmpeg version used by serviio is well described and easily done.
Also found an issue on bitbucket: https://bitbucket.org/xnejp03/serviio/issues/930/hardware-acceleration
which leads to the assumption that using quicksync can be possible with serviio 1.7.

It would be nice to give me and I guess some other people out there a hint how to activate the quicksync transcoding on a windows installation of serviio.

Thank you very much!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Oct 09, 2016 7:27 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Mon Oct 10, 2016 7:03 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Thank you very much for pointing me in the right direction - ffmpeg.exe is updated, -Dserviio.useQSVAcceleration included.
Quick test with an hevc-encoded film shows no usage of quicksync as far as I can tell (GPU-Z).

Looked into profiles.xml and as far as I can tell panasonic profiles transcode to mpeg2video which is not accellerated by quicksync (yet?).
Guess I have to find out how to include/change profiles.xml to trancode hevc to h264 (or has it to be h264_qsv?) without breaking something now.
Any hint on this one?

Keep up the great work!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Oct 11, 2016 8:28 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Ah yes, change the profile to transcode to h264 or build a new profile. Serviio will then use h264_qsv encoder.
<<

DenyAll

DLNA master

Posts: 2257

Joined: Fri Mar 08, 2013 11:16 pm

Location: Adelaide, Australia

Post Wed Oct 12, 2016 12:27 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

and please post how it goes, what your experience is like etc - I'd like to see how the quicksync encoder goes.
Cheers
DenyAll
Panasonic Viera FX800A | Panasonic Viera CS610A | Sony PS4 | Sony PS3 | Panasonic DMP-BD79 | Yamaha RX-V500D | iPad | Windows 10 | Serviio 1.10.1 Pro
WinHelper | MediaInfo

Beta Tester, Moderator
Please do not PM me for support as any solution cannot be shared with others.
<<

atc98092

User avatar

DLNA master

Posts: 5213

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Wed Oct 12, 2016 12:39 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

DenyAll wrote:and please post how it goes, what your experience is like etc - I'd like to see how the quicksync encoder goes.
Cheers


I second that. If it really makes an improvement, it may be time to swap out my AMD CPU and switch to Intel. It seems that Intel is the only way to get hardware acceleration for video work. I'd like to speed up my VideoReDo editing as well, and it also supports Quick Sync.
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Oct 13, 2016 7:26 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Read this: https://trac.ffmpeg.org/wiki/HWAccelIntro

Then you need ffmpeg with --enable-libmfx which I think Zeranoe might be. You need the the Intel Media SDK integrated in the Intel Media Server Studio to get the driver headers for FFmpeg to hook into.

Then you pass -Dserviio.useQSVAcceleration to Serviio system properties and once it finds h264 as the transcoding codec it'll use h264_qsv instead to utilise HW acceleration.
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Fri Oct 21, 2016 9:13 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Hello, here a short update on what I managed to do so far:

First there is a change of hardware description since I swapped server hardware with my brother some time ago..
So the intel cpu i intend to use is a j1900 (quicksync h264 hw-encoding works in handbrake/mediacoder):

Following the steps given by Petr I managed to got quicksync hardware encoding working on my main work computer (i7-4790k). Did it first on that machine in order to prevent wifely disapproval due to possible downtime/breakage of video playback on TV.

Changes to "profiles.xml":

With an adapted panasonic profilefor handling unsupported codecs :
<Video targetContainer="mpegts" targetVCodec="h264" maxVBitrate="12000" forceVTranscoding="true" targetACodec="ac3" aBitrate="384" forceInheritance="true">
instead of
<Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384" forceInheritance="true">

Results intel i7:

The h264 files streamed without encoding as they should.
I was able to play h265 encoded videos with quicksync hardware support confirmed by gpu-z (100% load on gpu load with limiting cpu-cores used for transcoding to 2 of 8).
Observing taskmanager and gpu-z transconding of a 60 minute video took only 10-12 Minutes (not measured). Quality was more than ok on tv-screen.

Transfer to Server:

I transfered "ServiioService.exe.vmoptions", "ffmpeg.exe" and "profiles.xml" from i7 to the Server, adjusted the profile for my tv and rebooted.

Results intel J1900:

Normal h264 videos stream without transcoding as they should.
Nevertheless, h265 videos do not play.

Log-File gives me the following:

2016-10-21 10:26:41,899 WARN [ProcessExecutor] Process cmd has a return code of 1! This is a possible error. Detailed output follows.
[h264_qsv @ 0000000001245cc0] Selected ratecontrol mode is not supported by the QSV runtime. Choose a different mode.
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

So far I am not sure if:

- The problem sits 40 cm from my screen and between my ears.
- There is a hardware limitation with the J1900 (mybe unlikely since quicksync encoding works with handbrake, mediacoder).
- There is a problem with ffmpeg not/not fully supports the J1900.
- There are different rate control modes available in serviio profiles.xml

Any input is highly welcome.

Anyways: Thank you for providing the use of hardware encoding in Serviio!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Oct 21, 2016 2:33 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

what is the full ffmpeg command line when you get the transcoding error? and is it the same as when used on your other working PC?
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Sun Oct 23, 2016 8:12 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Good question, I am not sure how to tell.

I guess that using the same profiles.xml with both computers playing the same file to with the same profile to my tv means using the same ffmpeg command line?

If I can get a hint where to look up the string then I will check.

Thank you very much!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Oct 24, 2016 7:43 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

you need to enable detailed logging and then play the file.
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Mon Oct 24, 2016 10:03 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Hello and thanks for the hint and the patience.

Seems that the ffmpeg strings are the same for both the i7-4970K and the J1900 setup. Out of curiousity I did a setup on a third machine with i3-3225. Also Win10 as the others and with the same ffmpeg.exe, profiles.xml and ServiioService.exe.vmoptions as the working i7 setup.

As with the J1900 setup, quicksync enabled hw-encoding does not work with the i3-3225 setup also.

Here the debug info with the ffmpeg strings and the results:

i7-4970K

2016-10-24 22:47:56,300 DEBUG [ProcessExecutor] Starting C:\Program Files\Tools\Serviio\bin\\..\lib\ffmpeg.exe -threads 2 -i D:\Recode\Test\Demo.mkv -y -c:v h264_qsv -pix_fmt yuv420p -b:v 12000k -maxrate:v 12000k -bufsize:v 12000k -preset:v fast -r 24000/1001 -g 15 -bsf:v h264_mp4toannexb -flags -global_header -c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -map 0:0 -map 0:1 -sn -f mpegts D:\Temp\Serviio\transcoding-temp-9fc84eef053b4d3d1599b3a7e9a2f2e1.stf

2016-10-24 22:47:56,676 DEBUG [MediaItemDAOImpl] Getting counts of media items by type
2016-10-24 22:47:57,300 DEBUG [FileBasedTranscodingDeliveryStrategy] Sending transcoding stream
2016-10-24 22:47:57,303 DEBUG [VideoDeliveryEngine] Found Format profile for transcoded file "Demo.mkv": AVC_TS_MP_HD_AC3_ISO
2016-10-24 22:47:57,305 INFO [PlaybackEventsManager] Playback of media item 2 has started at 0% on Identifier=192.168.31.221, Profile=Panasonic Viera G/GT/DT/UT/VT (2011/2012), Name=BubbleUPnP Media Renderer

i3-3225

2016-10-24 22:50:12,192 DEBUG [ProcessExecutor] Starting C:\Program Files\Tools\Serviio\bin\\..\lib\ffmpeg.exe -threads 2 -i D:\Recode\Test\Demo.mkv -y -c:v h264_qsv -pix_fmt yuv420p -b:v 12000k -maxrate:v 12000k -bufsize:v 12000k -preset:v fast -r 24000/1001 -g 15 -bsf:v h264_mp4toannexb -flags -global_header -c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -map 0:0 -map 0:1 -sn -f mpegts C:\Temp\Serviio\transcoding-temp-91b630391dac5e33d71ec38b76641c40.stf

2016-10-24 22:50:12,365 WARN [ProcessExecutor] Process cmd has a return code of 1! This is a possible error. Detailed output follows.
encoder : Lavc57.48.101 ac3
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

J1900

2016-10-24 23:05:18,303 DEBUG [ProcessExecutor] Starting C:\Program Files\Tools\Serviio\bin\\..\lib\ffmpeg.exe -threads 3 -i D:\Recode\Test\Demo.mkv -y -c:v h264_qsv -pix_fmt yuv420p -b:v 12000k -maxrate:v 12000k -bufsize:v 12000k -preset:v fast -r 24000/1001 -g 15 -bsf:v h264_mp4toannexb -flags -global_header -c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -map 0:0 -map 0:1 -sn -f mpegts C:\TEMP\Serviio\transcoding-temp-a53e7dbcdee0158baeb542f6ca4f5115.stf

2016-10-24 23:05:18,499 WARN [ProcessExecutor] Process cmd has a return code of 1! This is a possible error. Detailed output follows.
encoder : Lavc57.48.101 ac3
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Mon Oct 24, 2016 10:12 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

A quick research on intel driver page shows that the celeron J1900 and the i3-3225 seem to share the same graphics generation and drivers. May it be possible that the hardware does not support something that is necessary for using quicksync enabled encoding.

Maybe some members of the forum are able to check the hw enabled encoding with their setups, preferably intel sandy bridge, ivy bridge, haswell, skylake and newer.

Thank you very much in advance.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Oct 25, 2016 8:09 am

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Try to execute this manually in command prompt

  Code:
ffmpeg.exe -threads 3 -i D:\Recode\Test\Demo.mkv -y -c:v h264_qsv -pix_fmt yuv420p -b:v 12000k -maxrate:v 12000k -bufsize:v 12000k -preset:v fast -r 24000/1001 -g 15 -bsf:v h264_mp4toannexb -flags -global_header -c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -map 0:0 -map 0:1 -sn -f mpegts C:\TEMP\Serviio\transcoding-temp-a53e7dbcdee0158baeb542f6ca4f5115.stf


Assuming that fails, try to change "-r 24000/1001" to "-r 24" or remove it altogehter. You could also play (or remove) these parameters: "-b:v 12000k -maxrate:v 12000k -bufsize:v 12000k"

Looks like one of these is something the encoder doesn't like.
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Tue Oct 25, 2016 6:37 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Hello Petr,

thanks for the support, but it seems that none of the changes do help the matter with the older intel setups I tried. Main error message in the output says:
...
[h264_qsv @ 0000000002b626e0] Selected ratecontrol mode is not supported by the QSV runtime. Choose a different mode.
...

A quick search on this gave me a ticket on ffmpeg.org: https://trac.ffmpeg.org/ticket/4831

I am by far no professional but in a quick read I get that the issue is with ffmpeg not serviio. Sometime around 14 month ago
the support of ivy-bridge (ie intel J1900 and i3-3225) and mybe sandy bridge got broken and I am not sure if there is a fix from ffmpeg.
At some point the ticket says to recompile ffmpeg with some switch to force support of older quicksync versions but I will have
to read again to be sure (never the less I am not able to compile anything at the moment...)

At least that gives an explanation for the behaviour and maybe also points to possible solution...

Thank you very much for your patience so far and keep up your great work!
<<

JakeS76

Serviio newbie

Posts: 8

Joined: Sat Oct 08, 2016 5:33 pm

Post Wed Oct 26, 2016 11:48 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

Hello,

I took some time to dig deeper in ffmpeg h264_qsv commands. Based on different sources the differences between ivy bridge based quicksync and post ivy bridge quicksync
is mainly the implementation of lookahead encoding. So I tried to insert "-look_ahead 0" in the ffmpeg comand.

And now it is encoding on the intel J1900 with hardware (quicksync) support confirmed in gpu-z.

It is getting late now and I will look deeper in the issue in the upcoming days and keep you updated.

Actual ffmpeg command: "ffmpeg.exe -threads 3 -i D:\Test\demo1.mkv -y -c:v h264_qsv -look_ahead 0 -pix_fmt yuv420p -b:v 12000k -maxrate:v 12000k -bufsize:v 12000k -preset:v fast -r 24 -g 15 -bsf:v h264_mp4toannexb -flags -global_header -c:a:0 ac3 -b:a:0 384k -ac:a:0 6 -map 0:0 -map 0:1 -sn -f mpegts C:\TEMP\Serviio\transcoding-temp-a53e7dbcdee0158baeb542f6ca4f5115.stf"
<<

hansj

Serviio newbie

Posts: 12

Joined: Fri Jul 13, 2012 1:51 pm

Post Wed Nov 02, 2016 10:42 pm

Re: Howto enable quicksync transcoding Serviio 1.7 / Windows

This is one way to do it, have you thought about a 4k able player?
What if you run kodi/whatever works on chromecast ultra and skip the transcoding?

The issue with most TV's is, you get no hw/sw upgrades. So "upgrading" your TV with a 4k able player will handle all h.265 content nicely.

I maybe going for a dumb 4k TV and let the smart part be a firestick/chromecast/...

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 59 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.