Emby Media Server - HW accelerated transcoding

Moderators: mdrjr, odroid

Emby Media Server - HW accelerated transcoding

Unread postby memeka » Mon Mar 20, 2017 9:44 am

With the ffmpeg patches that enable encoding, and with a few modifications to emby media server, I was able to do hardware transcoding when streaming from emby server.

emby.jpg
(117.54 KiB) Downloaded 286 times


Not sure if there are any emby users (most people i guess want plex), but since plex uses its own ffmpeg (and code is not open), it's a bit harder to have hw transcoding than with emby.

Here's the server log:
Code: Select all
http://129.127.248.18:8096/emby/videos/0263a73ae384c2feef7b07256f1a8c97/hls1/main/0.ts?DeviceId=39bd3c935755c4f8f5fb742f0026f67ae17b13f9&MediaSourceId=0263a73ae384c2feef7b07256f1a8c97&VideoCodec=h264&AudioCodec=aac,mp3&AudioStreamIndex=1&VideoBitrate=599872296&AudioBitrate=127704&Level=51&Profile=high&PlaySessionId=e47b6e3376b94bae846e45d4909a843e&api_key=eebfa201aa2b453ea72febf6b65943d1&CopyTimestamps=false&TranscodingMaxAudioChannels=6&EnableSubtitlesInManifest=false&Tag=014fae5077a8f8d2ee962659fef2a772&RequireAvc=true

{"Protocol":"File","Id":"0263a73ae384c2feef7b07256f1a8c97","Path":"/home/odroid/Video/mono.avi","Type":"Default","Container":"avi","Name":"SD/MSMPEG4/MP3","IsRemote":false,"ETag":"014fae5077a8f8d2ee962659fef2a772","RunTimeTicks":80035233792,"ReadAtNativeFramerate":false,"SupportsTranscoding":true,"SupportsDirectStream":true,"SupportsDirectPlay":true,"IsInfiniteStream":false,"RequiresOpening":false,"RequiresClosing":false,"SupportsProbing":true,"VideoType":"VideoFile","MediaStreams":[{"Codec":"msmpeg4","CodecTag":"DIV3","TimeBase":"4171/100000","CodecTimeBase":"4171/100000","IsInterlaced":false,"BitRate":573722,"RefFrames":1,"IsDefault":false,"IsForced":false,"Height":288,"Width":512,"AverageFrameRate":23.97507,"RealFrameRate":23.97507,"Type":"Video","AspectRatio":"16:9","Index":0,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"PixelFormat":"yuv420p","Level":-99,"IsAnamorphic":false},{"Codec":"mp3","TimeBase":"1/15963","CodecTimeBase":"1/44100","DisplayTitle":"MP3 stereo","IsInterlaced":false,"ChannelLayout":"stereo","BitRate":127704,"Channels":2,"SampleRate":44100,"IsDefault":false,"IsForced":false,"Type":"Audio","Index":1,"IsExternal":false,"IsTextSubtitleStream":false,"SupportsExternalStream":false,"Level":0,"IsAnamorphic":false}],"PlayableStreamFileNames":[],"Formats":[],"Bitrate":706525,"RequiredHttpHeaders":{}}

/usr/local/bin/ffmpeg -f avi -codec:0 msmpeg4 -codec:1 mp3 -i file:"/home/odroid/Video/mono.avi" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_v4l2m2m -pix_fmt nv21  -b:v 573722 -maxrate 573722 -bufsize 1147444 -vsync -1 -force_key_frames "expr:gte(t,n_forced*3)" -vf "scale=trunc(min(max(iw\,ih*dar)\,720)/2)*2:trunc(ow/dar/2)*2" -copyts -codec:a:0 copy -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time 3  -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list "/home/odroid/src/emby/Emby-3.2.8/Tools/Linux_Build_Scripts/mediabrowser/MediaBrowser.Mono.3.2.8.0/ProgramData-Server/transcoding-temp/117f397dcd8a9192fa06100a7d26448f.m3u8" -y "/home/odroid/src/emby/Emby-3.2.8/Tools/Linux_Build_Scripts/mediabrowser/MediaBrowser.Mono.3.2.8.0/ProgramData-Server/transcoding-temp/117f397dcd8a9192fa06100a7d26448f%d.ts"


ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-6) 20170205
  configuration: --prefix=/usr/local --libdir=/usr/local/lib --incdir=/usr/local/include --pkg-config-flags=--static --enable-gpl --enable-static --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --disable-stripping
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, avi, from 'file:/home/odroid/Video/mono.avi':
  Duration: 02:13:23.52, start: 0.000000, bitrate: 706 kb/s
    Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 512x288, 573 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 127 kb/s
[h264_v4l2m2m @ 0x80886330] Device path not set, probing /dev/video*
[h264_v4l2m2m @ 0x80886330] Using device /dev/video11
[h264_v4l2m2m @ 0x80886330] mfc-enc: gop_size: 12
[h264_v4l2m2m @ 0x80886330] mfc-enc: enabling bitrate control if required rate 573722 > 1
[h264_v4l2m2m @ 0x80886330] mfc-enc: max b-frames: 0
[h264_v4l2m2m @ 0x80886330] mfc-enc: h264 profile: 4
[h264_v4l2m2m @ 0x80886330] mfc-enc: min/max quantizer scale: (2, 31)
[h264_v4l2m2m @ 0x80886330] mfc-enc: h264 level: V4L2_MPEG_VIDEO_H264_LEVEL_4_0
Output #0, segment, to '/home/odroid/src/emby/Emby-3.2.8/Tools/Linux_Build_Scripts/mediabrowser/MediaBrowser.Mono.3.2.8.0/ProgramData-Server/transcoding-temp/117f397dcd8a9192fa06100a7d26448f%d.ts':
  Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0: Video: h264 (h264_v4l2m2m), nv21, 512x288, q=2-31, 573 kb/s, 23.98 fps, 90k tbn, 23.98 tbc
    Metadata:
      encoder         : Lavc57.24.102 h264_v4l2m2m
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 127 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4v3 (msmpeg4) -> h264 (h264_v4l2m2m))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0x80886330] Performing useless memcpy() on output pool because buffers do not match
[h264_v4l2m2m @ 0x80886330] This could be avoided by using av_v4l_buffer_pool_get_buffer*() or av_v4l_buffer_pool_make_pipe()
[segment @ 0x80887200] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x80887200] Encoder did not produce proper pts, making some up.
frame=  439 fps=0.0 q=-0.0 size=N/A time=00:00:19.03 bitrate=N/A speed=  38x   
frame=  857 fps=856 q=-0.0 size=N/A time=00:00:36.53 bitrate=N/A speed=36.5x   
frame= 1259 fps=838 q=-0.0 size=N/A time=00:00:53.04 bitrate=N/A speed=35.3x   
frame= 1667 fps=833 q=-0.0 size=N/A time=00:01:10.02 bitrate=N/A speed=  35x 
Last edited by memeka on Mon Mar 20, 2017 3:04 pm, edited 1 time in total.
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Mon Mar 20, 2017 2:59 pm

Requirements:

* kernel patch to enable encoder timestamps: https://github.com/mihailescu2m/linux/c ... cc26aabc09
* patched ffmpeg: https://github.com/mihailescu2m/FFmpeg/ (the v4l2_m2m branches)
* emby patch: http://paste.debian.net/922751/
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Wed Mar 22, 2017 9:52 pm

I tried transcoding 4K HEVC and streaming to a browser in 720p using emby + mfc:

frame= 2002 fps= 12 q=-0.0 size=N/A time=00:01:24.08 bitrate=N/A speed=0.519x

seems like i wanted too much :) the video would "buffer" every minute or so (the problem being that transcoding speed with 4K HEVC software decoding was 52% framerate)
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby kicker22004 » Tue Apr 04, 2017 8:27 pm

I'm interested in trying this out, I've managed to get encoding to work for Plex but with the normal issues. Any chance you could post your steps for setting this up? Thank you
kicker22004
 
Posts: 51
Joined: Tue Dec 08, 2015 4:20 am
languages_spoken: english

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Mon Apr 10, 2017 7:20 am

i'll be releasing an update to my wayland-stretch image that will contain emby server
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Mon Apr 10, 2017 2:17 pm

Great! I just ordered a odroid xu4 and wait paitently for your emby server ffmpeg package. ;)
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby rooted » Mon Apr 10, 2017 6:27 pm

Could you post a video of the quality?
User avatar
rooted
 
Posts: 5306
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Mon Apr 10, 2017 7:55 pm

rooted wrote:Could you post a video of the quality?


quality is good but cannot show since i only got old 480p avi movies to transcode :) all my HD media is h264
but transcoding manually with ffmpeg with the same settings show good quality (higher quality with higher bitrate)...
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby rooted » Tue Apr 11, 2017 3:51 pm

So no strange artifacts and quality matched bitrate, good enough for me.
User avatar
rooted
 
Posts: 5306
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Tue May 02, 2017 7:26 pm

Yesterday I got my XU4. Hope that memeka will release his tuned emby version when he's back from vacation. :-)
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby johnvick » Thu Jun 01, 2017 8:40 am

I am running dietpi v150, kernel 4.9 and Emby - I was hoping the new kernel would help with video transcoding but 1080p still stutters. I don't know if this is overheating as the device went up to 95 C.

I then tried using the custom ffmpeg as in this post:

viewtopic.php?f=95&t=24366

but I got errors and it didn't install.

I see Emby has an option to select between system ffmpeg and custom one. Anyone help to get this working?

John
johnvick
 
Posts: 34
Joined: Wed May 11, 2016 5:26 pm
languages_spoken: english
ODROIDs: XU4, Cloudshell, C2x2

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Jun 01, 2017 8:56 am

johnvick wrote:I am running dietpi v150, kernel 4.9 and Emby - I was hoping the new kernel would help with video transcoding but 1080p still stutters. I don't know if this is overheating as the device went up to 95 C.

I then tried using the custom ffmpeg as in this post:

viewtopic.php?f=95&t=24366

but I got errors and it didn't install.

I see Emby has an option to select between system ffmpeg and custom one. Anyone help to get this working?

John


download emby 3.2.8 from:

Code: Select all
https://oph.mdrjr.net/memeka/emby/


it's got support for Exynos MFC (XU4) hardware transcoding - you need to select it from the emby transcoding settings.
you will also need to install the ffmpeg (3.2) packages from that folder. they are for debian stretch, so i don't know if other package requirements will be satisfied on your distribution.
@meveric has ffmpeg packages for debian jessie at https://oph.mdrjr.net/meveric/kernel/XU3/4.9.x/ffmpeg/ , so you may try those, they are more compatible with older distributions.
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby johnvick » Thu Jun 01, 2017 1:24 pm

Thanks this looks promising but is this version of Emby for Windows?
johnvick
 
Posts: 34
Joined: Wed May 11, 2016 5:26 pm
languages_spoken: english
ODROIDs: XU4, Cloudshell, C2x2

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Jun 01, 2017 1:44 pm

johnvick wrote:Thanks this looks promising but is this version of Emby for Windows?

why would it be for Windows? it runs on the XU4 :)

emby is a .NET application, so you need to install mono dependencies. check the linux install guide from their website for more details.
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby johnvick » Thu Jun 01, 2017 2:01 pm

Just saw all the dll files and thought WIndows :)

I have Emby and Mono installed already through the diet pi menus system. I'm not sure how to install the version you have?

Thanks, John
johnvick
 
Posts: 34
Joined: Wed May 11, 2016 5:26 pm
languages_spoken: english
ODROIDs: XU4, Cloudshell, C2x2

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Jun 01, 2017 5:40 pm

extract the archive and overwrite the one you have installed :)
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby johnvick » Thu Jun 01, 2017 7:08 pm

memeka wrote:extract the archive and overwrite the one you have installed :)


Thanks for your help with this - where is emby installed?

I have a lot of stuff in /var/lib/emby-server but this doesn't look like the right place.

And doesn't your custom version get overwritten with the next emby update?
johnvick
 
Posts: 34
Joined: Wed May 11, 2016 5:26 pm
languages_spoken: english
ODROIDs: XU4, Cloudshell, C2x2

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Jun 01, 2017 7:42 pm

don't update emby :P
also, i have no idea where emby gets installed by dietpi :) you'll have to ask whoever packaged it...
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Thu Jun 01, 2017 8:59 pm

memeka wrote:
download emby 3.2.8 from:

Code: Select all
https://oph.mdrjr.net/memeka/emby/


it's got support for Exynos MFC (XU4) hardware transcoding - you need to select it from the emby transcoding settings.
you will also need to install the ffmpeg (3.2) packages from that folder. they are for debian stretch, so i don't know if other package requirements will be satisfied on your distribution.
@meveric has ffmpeg packages for debian jessie at https://oph.mdrjr.net/meveric/kernel/XU3/4.9.x/ffmpeg/ , so you may try those, they are more compatible with older distributions.



Oh, great to hear memeka. That's the same what I want to do. I will try later when I'm at home. Thx

EDIT: Is there a way to patch a newer version by myself to got support for MFC?
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby johnvick » Fri Jun 02, 2017 3:43 am

memeka wrote:don't update emby :P
also, i have no idea where emby gets installed by dietpi :) you'll have to ask whoever packaged it...


The DietPi version of Emby comes from the opensuse repository but beyond that I don't know much.

Also tried the Jessie ffmpeg https://oph.mdrjr.net/meveric/kernel/XU3/4.9.x/ffmpeg/

But it didn't install under DietPi - several error messages. Completely broke ffmpeg so I had to restore from backup.

John
johnvick
 
Posts: 34
Joined: Wed May 11, 2016 5:26 pm
languages_spoken: english
ODROIDs: XU4, Cloudshell, C2x2

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Tue Jun 06, 2017 6:15 am

johnvick wrote:
memeka wrote:don't update emby :P
also, i have no idea where emby gets installed by dietpi :) you'll have to ask whoever packaged it...


The DietPi version of Emby comes from the opensuse repository but beyond that I don't know much.

Also tried the Jessie ffmpeg https://oph.mdrjr.net/meveric/kernel/XU3/4.9.x/ffmpeg/

But it didn't install under DietPi - several error messages. Completely broke ffmpeg so I had to restore from backup.

John


Same problem here :(
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Tue Jun 06, 2017 8:55 am

sorry i don't know what packages DietPi uses :(
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Sat Jul 01, 2017 6:09 pm

Hey, I was just looking to try this myself on my XU4 running Ubuntu 16.04.2 minimal, and but I couldn't even get emby-server to install using the opensuse repositories. Got a lot of unmet dependencies, some of which can't be installed with the existing repositories. Do I need to add something to the sources list, or is there a way to install this version of emby directly, rather than overwriting some of the files with the aforementioned patch?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Sun Jul 02, 2017 8:36 am

you can unzip and run
but you need to have all required mono packages installed.
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Sun Jul 02, 2017 9:31 am

Unzip and run MediaBrowser.Server.Mono.exe from MediaBrowser.Mono.3.2.8.0.tar.gz on Ubuntu? How is the exe supposed to run without wine, or is there no way to run it natively?

And where do I get the mono packages? Are they the .deb binaries in the same directory?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby mad_ady » Sun Jul 02, 2017 3:09 pm

Mono is an opensource implementation of the dotNET apis, so, as long as the application doesn't make any native windows calls, you won't need wine to run it (even on x86).
Regarding running nativelly, it's the same as running java. It's not cpu emulation, but it's interpreting some bytecode.
User avatar
mad_ady
 
Posts: 4221
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Mon Jul 03, 2017 6:46 am

Huh, so it's interpreting at runtime like Java? Wouldn't that increase the overhead compared to something compiled ahead of time?
Also, I found the repository to get mono here: http://www.mono-project.com/download/#d ... lin-ubuntu, but it still seems like I don't have the needed repositorie(s) for libembysqlite3-0 and embymagick. Thanks for jumping in. :) Am I understanding correctly, that if I can get these packages and install emby-server, I need only overwrite files that will be installed in the process with those having the same names from the tarball in https://oph.mdrjr.net/memeka/emby/ and install the ffmpeg packages from the same directory? Or am I supposed to somehow use mono to run/install the files from the tarball directly?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby mad_ady » Tue Jul 04, 2017 2:41 am

I wouldn't know - I don't use emby. I'm sure @memeka can help you
User avatar
mad_ady
 
Posts: 4221
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Wed Jul 05, 2017 8:46 am

Ah, well thanks anyway. What do you use? Plex? Is there a way to do HW transcoding with a media server besides the one mentioned here?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Thu Jul 20, 2017 3:28 pm

I wanted to do this for my setup but without a reproducible method to patch future emby versions I held back.
FYI, I just installed Plex and it has an "original" version feature in playback that does no transcoding so you can save your cores some pain. Wish emby had that feature.

This is sad, I really liked emby...
I might keep both around, emby for my Kodi and Plex for all other devices.
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Thu Jul 20, 2017 9:29 pm

memeka wrote:Requirements:

* kernel patch to enable encoder timestamps: https://github.com/mihailescu2m/linux/c ... cc26aabc09
* patched ffmpeg: https://github.com/mihailescu2m/FFmpeg/ (the v4l2_m2m branches)
* emby patch: http://paste.debian.net/922751/


@memeka: the last link seems to be dead.
Could you repost it?
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Fri Jul 21, 2017 8:57 pm

@crazyquark If you've had some luck with the ordinary version of emby, do you know what repository I should use for the unmet/uninstallable libembysqlite3-0 and embymagick packages? Also, are you saying emby can't direct play?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Mon Jul 24, 2017 9:12 pm

It can, supposedly direct play but it seems it chooses not to, at least on the videos I tested while Plex correctly does so.
I think these are the sources I used:

deb http://download.opensuse.org/repositori ... ntu_14.04/ /
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Wed Jul 26, 2017 3:10 pm

Is this thread dead?
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Thu Jul 27, 2017 11:58 am

Oh sorry, @crazyquark. I certainly hope not, but it looks as if memeka hasn't been active on the forums since the beginning of the month, so I don't know when they'll be back.
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby Padroid » Thu Jul 27, 2017 11:59 am

Also, I think I used the equivalent 16.04 repository (because that's what I'm running), but perhaps that was a mistake?
Padroid
 
Posts: 7
Joined: Sat Jul 01, 2017 5:25 pm
languages_spoken: english
ODROIDs: XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Thu Jul 27, 2017 4:02 pm

Humm, could be that they do not provide the same dependencies on that repo.
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby crazyquark » Mon Aug 28, 2017 9:12 pm

@memeka, any chance you got provide the emby patch again?
The previous link is dead.
crazyquark
 
Posts: 264
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Tue Aug 29, 2017 8:29 am

exynos patch 1: https://paste.debian.net/983453/

*new* exynos patch 2 (fixes scaling for some resolutions): https://paste.debian.net/983452/
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby studioai » Fri Sep 01, 2017 3:26 pm

@memeka

Do you have any plan to submit those code to Emby's git repo?
studioai
 
Posts: 11
Joined: Thu Apr 21, 2016 10:43 am
languages_spoken: english
ODROIDs: xu4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Fri Sep 01, 2017 4:11 pm

i thought i did sent patch 1 :) can't remember :D
not really that big fan of the android tv app :( so i stopped using it ...
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Tue Sep 12, 2017 2:08 pm

johnvick wrote:I am running dietpi v150, kernel 4.9 and Emby - I was hoping the new kernel would help with video transcoding but 1080p still stutters. I don't know if this is overheating as the device went up to 95 C.

I then tried using the custom ffmpeg as in this post:

viewtopic.php?f=95&t=24366

but I got errors and it didn't install.

I see Emby has an option to select between system ffmpeg and custom one. Anyone help to get this working?

John


Now after the patches are in the last emby beta I want to try it again to install patched ffmpeg in dietpi but I'm failed again. Took me 4 hours to repair broken apt-get with missing dependencies.

Could somebody help me to install patched ffmpeg on dietpi?
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Fri Sep 15, 2017 4:37 am

dietpi is running on debian jessie and use this packages:

Code: Select all
deb http://ftp.debian.org/debian/ jessie main contrib non-free
deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
deb http://security.debian.org jessie/updates main contrib non-free
deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free


Ok, now I tried to compile ffmpeg for myself with the patch but after finished I don't get the exynos encoder?

Here my buildconfig:
Code: Select all
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...


Code: Select all
DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 libx264rgb h264_vaapi )
 D.VIL. hap                  Vidvox Hap decoder
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 )


I get it working under Ubuntu 16.04 but now I had the problem that the output hat green lines and are distorted.
What I'm doing wrong?
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Thu Dec 28, 2017 10:21 am

With meverics help I get it working. But now I have another problem. The output seems to big. Is there something I missed?

In Emby I get this:

Code: Select all
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_v4l2m2m))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0x529120] driver 'exynos-gsc' on card 'exynos-gsc gscaler'
    Last message repeated 1 times
[h264_v4l2m2m @ 0x529120] driver 's5p-mfc' on card 's5p-mfc-enc'
[h264_v4l2m2m @ 0x529120] Using device /dev/video11
[h264_v4l2m2m @ 0x529120] driver 's5p-mfc' on card 's5p-mfc-enc'
[h264_v4l2m2m @ 0x529120] h264 profile not found
[h264_v4l2m2m @ 0x529120] Encoder adjusted: qmin (0), qmax (51)


why is h264 missing and no encoder adjustment set?

What can I do to make it work?
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Dec 28, 2017 10:45 am

bgx wrote:why is h264 missing and no encoder adjustment set?
What can I do to make it work?


it's working, don't worry. you can ignore those messages.
you can check CPU usage when doing transcoding...
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Thu Dec 28, 2017 6:30 pm

memeka wrote:
bgx wrote:why is h264 missing and no encoder adjustment set?
What can I do to make it work?


it's working, don't worry. you can ignore those messages.
you can check CPU usage when doing transcoding...
Ok. But the output is bigger than the input and that's the reason why it's unplayable. What can I do to make the stream smaller? I tried to change the CRF setting for transcoding in emby but that didn't help.

Gesendet von meinem MHA-L29 mit Tapatalk
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Thu Dec 28, 2017 7:57 pm

I see. This means probably you are running the mainline ffmpeg version, which doesn't support bitrate for the XU4.
So every file encoded uses maximum bitrate...
You can try installing this ffmpeg version which is patched to enable bitrate: https://oph.mdrjr.net/memeka/ffmpeg/ see if this one works for you ... (not 100% sure if it's compatible with your OS)
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby bgx » Thu Dec 28, 2017 11:54 pm

Great memeka,

after installing your ffmpeg version over my last it seems nothing changed. Should I install all other debs also?

Output from emby server:
Code: Select all
frame= 1306 fps= 20 q=-0.0 size=N/A time=00:02:07.00 bitrate=N/A speed=1.96x   
frame= 1316 fps= 20 q=-0.0 size=N/A time=00:02:07.32 bitrate=N/A speed=1.95x   
frame= 1327 fps= 20 q=-0.0 size=N/A time=00:02:07.84 bitrate=N/A speed=1.94x   
frame= 1334 fps= 20 q=-0.0 size=N/A time=00:02:08.09 bitrate=N/A speed=1.93x   
frame= 1345 fps= 20 q=-0.0 size=N/A time=00:02:08.73 bitrate=N/A speed=1.93x   
frame= 1356 fps= 20 q=-0.0 size=N/A time=00:02:09.18 bitrate=N/A speed=1.92x   
frame= 1366 fps= 20 q=-0.0 size=N/A time=00:02:09.47 bitrate=N/A speed=1.91x   
[segment @ 0x563e10] Opening '/var/lib/emby-server/transcoding-temp/0185ef5b260a351fc0420480fbb38c60.m3u8.tmp' for writing
[segment @ 0x563e10] Opening '/var/lib/emby-server/transcoding-temp/0185ef5b260a351fc0420480fbb38c6043.ts' for writing
[segment @ 0x563e10] Opening '/var/lib/emby-server/transcoding-temp/0185ef5b260a351fc0420480fbb38c60.m3u8.tmp' for writing
frame= 1372 fps= 20 q=-0.0 Lsize=N/A time=00:02:09.69 bitrate=N/A speed= 1.9x   
video:517961kB audio:4555kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bgx
 
Posts: 52
Joined: Tue Nov 29, 2016 4:12 pm
languages_spoken: english, german
ODROIDs: C2, XU4

Re: Emby Media Server - HW accelerated transcoding

Unread postby memeka » Fri Dec 29, 2017 5:17 am

you need to install libavcodec, but libavcodec might need installing other packages from there as well for compatibility.
User avatar
memeka
 
Posts: 4001
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Emby Media Server - HW accelerated transcoding

Unread postby mad_ady » Sat Dec 30, 2017 3:35 am

Offtopic, but I wonder - are there major fixes with regard to encoding that were absent in 4.9? Or is it just that mainline ffmpeg has caught up with existing support?
User avatar
mad_ady
 
Posts: 4221
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Next

Return to Projects

Who is online

Users browsing this forum: No registered users and 2 guests