ffmpeg encoding via docker (just for fun)

  • Hi,

    Just for fun, I tried the following on my s905x 1GB RAM tv box running kszaq's LE 8.2.0.1 build,

    Step 1 - Installed docker from the libreelec addons repository and then...

    Step 2 - Add some aliases to your .profile and save it.

    Code
    nano /storage/.profile
    Code
    alias docker="/storage/.kodi/addons/service.system.docker/bin/docker"
    alias ffmpeg="/storage/.kodi/addons/service.system.docker/bin/docker run -v /storage/:/tmp/ forumi0721alpineaarch64/alpine-aarch64-ffmpeg"

    Step 3 - Log out of the shell and log in again for your updated .profile to take effect.

    Step 4 - Grab the ffmpeg aarch64 image.

    Code
    docker pull forumi0721alpineaarch64/alpine-aarch64-ffmpeg

    Step 5 - Mount your video folder within /storage/ (I'll let you work out how best to do this based on your own setup)

    Step 6 - Use ffmpeg to encode a video. (example shown below)

    Code
    ffmpeg -i /tmp/<yourvideofolder>/input.mkv -c:s copy -c:v libx265 -preset medium -x265-params crf=28 -c:a aac -strict experimental -b:a 128k /tmp/<yourvideofolder>/output.mkv

    On my test encode via my video folder on my arch linux NFS file server (over 100Mbps ethernet) I got a whole 5fps encode rate when converting an x264 video to x265 with aac audio.

    Like I say, this was just for fun so I thought I would share my experience.

    Wouldn't it be good if if we could use the s905x gpu to hw accelerate the encode! :)

    Edited once, last by Adr3nal1n (November 9, 2017 at 6:25 PM).

  • As long as AMLogic does not put encoding capabilities in its soc's, that won't happen.

    Getting 5fps or so all depends on your cpu power, but it won't get higher that much.

    You may try getting Intel's QuickSync to work on a PC, otherwise the best options are the Nvidia GPUs. AMD's apus will probably work too, but I have no recent AMD gpu here. You now may get 5fps (I'm guessing with a 1080p video), simply copying the audio track instead of recoding it to 128k could up the fps rate a bit here. Although 5fps isn't that bad I guess, an Nvidia card will start at 140-150fps encoding, depending on further settings.

  • Klojum

    Oh yeah, I use my Intel pc dual-core haswell pentium cpu with h264_vaapi and that yields over 500fps when encoding. No hevc_vaapi on Haswell unfortunately. :)

    I was just curious to see what I could get out of the s905x SOC, but as you say, without a means to invoke gpu encoding it was always going to be slow.

    This article here Amlogic S905X Specifications | NEXBOX TV Box suggests the s905x can do hardware encoding of h.264 "H.264 video encoding up to 1080P@60fps with low latency". Although I guess there is no way currently of utilising that through ffmpeg.

    Still, I am very impressed with the playback capabilities of the s905x and the work that the kszaq and the Libreelec community have been doing to provide such a great linux/kodi distro for it.