Project

General

Profile

Hardware transcoding on Odroid XU4

Added by Davor Komljenovic over 4 years ago

Hello,

Is it possible to use hardware transcoding in Tvheadend on Odroid XU4? I currently run Debian Jessie headless server that has an older kernel. Newest kernel 4.9 "fixes" hardware transcoding on Odroid XU4. I would like to take advantage of that capability. I need to transcode live TV to reduce the bitrate to reasonable level so I can watch it over the internet. I am considering upgrading the kernel to 4.9 but only if I can actually take advantage of Odroid XU4 hardware transcoding. Otherwise I will continue using the current kernel.

Any help or suggestions is appreciated.


Replies (12)

RE: Hardware transcoding on Odroid XU4 - Added by Mark Clarkstone over 4 years ago

Sorry no one has replied to your query.

Hardware transcoding isn't working fully in Tvheadend at the moment, but it is possible to kind of pass transcoded streams along to tvheadend. Look at this for an idea.

RE: Hardware transcoding on Odroid XU4 - Added by Robert Cameron over 4 years ago

It's funny, just this past weekend I was browsing the Odroid forums for the XU4 (I was curious about the CloudShell2), and saw many posts about 4.9 and stability issues, and a few regarding hardware transcoding.

How does the hardware transcoding get exposed on the XU4? Is it through a standard interface (such as OpenMAX, VA-API or VDPAU) or is it a proprietary API (such as with Amlogic devices)? If it is standard, it should work fine, but there are caveats.

I can say that hardware encoding with VA-API (to H.264) is currently broken, but I'll have to double check my build to see if I built it with ffmpeg statically linked or not, and whether I used my build of ffmpeg or had Tvheadend use its own.
(The VA-API issue is that it tries to pass a present to ffmpeg when encoding, but the h264_vaapi encoder does not use many of the options/parameters that regular libx264 does, instead it is much less full featured probably because it is much less mature at the moment.)

RE: Hardware transcoding on Odroid XU4 - Added by Davor Komljenovic over 4 years ago

I don't know how hardware transcoding gets exposed on the XU4. I also posted on Odroid forums asking about possibility to use it. On those forums the users don't know how to use it with tvh. They do know that it works in 4.9 but as Robert said, there are stability issues with that kernel.

If I understand what you wrote Robert, it is possible to use hardware transcoding in tvh. So I guess now I have to head back to the Odroid forum to ask how is hardware transcoding implemented on the XU4.

RE: Hardware transcoding on Odroid XU4 - Added by Robert Cameron over 4 years ago

Looking at some more forum posts, it looks like current ffmpeg builds can use the hardware encoder exposed through 4.9 on the XU4. By setting the output codec to h264, it will natively choose to use the hardware encoder. In this case, it looks like you might need to use a build of Tvheadend on the XU4 that was compiled with --disable-ffmpeg_static --enable-libx264 --disable-libx264_static. This will use the native ffmpeg on your system instead of an internal version.

RE: Hardware transcoding on Odroid XU4 - Added by Davor Komljenovic over 4 years ago

Thanks. With this information, I can now wait until the 4.9 kernel has resolved its bugs and then attempt to install 4.9 on XU4. My current system is stable, Tvheadend and Oscam work perfectly, so I will only change to 4.9 once I am sure everything can work on it PLUS I can use hardware transcoding.

Thank you Robert. I will make another post once I get this working to let people know whether it is possible to run hardware transcoding on XU4 and Tvheadend.

RE: Hardware transcoding on Odroid XU4 - Added by Davor Komljenovic over 4 years ago

Robert Cameron wrote:

Looking at some more forum posts, it looks like current ffmpeg builds can use the hardware encoder exposed through 4.9 on the XU4. By setting the output codec to h264, it will natively choose to use the hardware encoder. In this case, it looks like you might need to use a build of Tvheadend on the XU4 that was compiled with --disable-ffmpeg_static --enable-libx264 --disable-libx264_static. This will use the native ffmpeg on your system instead of an internal version.

I managed to install 4.9, compile ffmpeg that can use hardware transcoding, built Tvheadend with options you listed.

So how do I now create a streaming profile to transcode live TV? Seems when I built Tvheadend with the options you listed, I don't have the transcoding enabled now. How do I build Tvheadend with transcoding enabled but still use system ffmpeg?

RE: Hardware transcoding on Odroid XU4 - Added by Robert Cameron over 4 years ago

Here's my configure for Tvheadend:

./configure --release --prefix=/usr         \
  --mandir=/usr/share/man/man1 --release    \
  --python=python3                          \
  --disable-ffmpeg_static --enable-libav    \
  --disable-libx264_static --enable-libx264 \
  --disable-libx265_static --enable-libx265 \
  --disable-libvpx_static                   \
  --disable-libtheora_static                \
  --disable-libvorbis_static                \
  --disable-libfdkaac_static                \
  --disable-libmfx_static --disable-qsv     \
  --disable-nvenc                           \
  --disable-hdhomerun_static --enable-hdhomerun_client

Then, when you create a new streaming profile, set it's type as "Transcode/avlib". From there, under the "Video Codec" menu you ought to see your options.

I'm not exactly sure how it'll work with the XU4, since the ffmpeg commands I've seen just show setting the output codec as h264, and it automatically selecting a hardware encoder.

Perhaps someone on the XU4 forums at odroid.com has more insight?

RE: Hardware transcoding on Odroid XU4 - Added by Davor Komljenovic over 4 years ago

I built Tvheadend again with these options: --disable-ffmpeg_static --enable-libav --disable-libx264_static --enable-libx264

Prior to that I did a "git pull" and then the build was without problems and I have the transcoding options.

I now have the problem with ffmpeg itself. So it's not a Tvheadend problem. From my point, everything related to Tvheadend is finished. Tvheadend allows me to use the system ffmpeg and as long as the system ffmpeg is working, the hardware transcoding will work. So for me this topic can be closed. I might report back later to give feedback on how good the transcoding is on XU4 once I figure out how to fix the ffmpeg issues.

RE: Hardware transcoding on Odroid XU4 - Added by Giuseppe Sicilia about 4 years ago

I got tvheadend hw transcode working with the pipe solution; i have created a local m3u file with entries for each sd channel:
File starts with


#EXTM3U
#EXTINF:-1,Das Erste
pipe:///usr/bin/ffmpeg -loglevel fatal -i http://user:[email protected]:9981/stream/channelnumber/101?profile=pass -c:v h264 -vf scale=-1:384 -pix_fmt nv21-c:a copy -metadata service_provider="Transcoded" -f mpegts pipe:1

My reffered Channel 101 is streamed with mpeg2 in sd resolution.
I was never able to use hw encoding with stream profiles. I think something was going wrong with ffmpeg options...

But after some tests i changed to sw transcoding:
With hw-transc i had to resize the video to 384p to minimize network traffic to 3mbit/s. The resulting quality was not pretty well.
Now, with -c:v libx264 (also pipe m3u) and "-crf 28 -preset: faster" i get streams with 2 mbit/s. Its looking fine on my ipad.
If someone want to use/test hw transcoding, here is the tvh thread:
https://forum.odroid.com/viewtopic.php?f=96&t=26469&start=100

P.S.: transcoding one sd channel increases my cpu load to ~300%.
Transcoding 2 channels simultanously is possible

RE: Hardware transcoding on Odroid XU4 - Added by Daniel MX almost 3 years ago

Davor Komljenovic wrote:

I now have the problem with ffmpeg itself. So it's not a Tvheadend problem. From my point, everything related to Tvheadend is finished. Tvheadend allows me to use the system ffmpeg and as long as the system ffmpeg is working, the hardware transcoding will work. So for me this topic can be closed. I might report back later to give feedback on how good the transcoding is on XU4 once I figure out how to fix the ffmpeg issues.

What ffmpeg issues did you have? Did you finally solved them?

RE: Hardware transcoding on Odroid XU4 - Added by Davor Komljenovic almost 3 years ago

Daniel, I had issues with building ffmpeg on my system then with actually running ffmpeg. I could not get it to run properly, probably due to issues that I had during the build.

That was long ago, it was with an old kernel. Since then a new kernel for my system is available and these build problems should be solved. Now that kernel 4.14 is available, I will try again to build ffmpeg and test the HW transcoding.

Did you attempt to build ffmepg on Odroid XU4 with kernel 4.14? It should be smooth. Also, did you try to do the transcoding as described in this thread?

    (1-12/12)