Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | FFmpeg: Enable HW encoding (RPi) #869

Closed
Fourdee opened this issue Apr 9, 2017 · 14 comments
Closed

DietPi-Software | FFmpeg: Enable HW encoding (RPi) #869

Fourdee opened this issue Apr 9, 2017 · 14 comments
Assignees
Milestone

Comments

@Fourdee
Copy link
Collaborator

Fourdee commented Apr 9, 2017

ADMIN EDIT

Please help testing the new RPi packages: #869 (comment)

G_AGI --reinstall ffmpeg

Requires binary compiles:
https://github.com/Fourdee/DietPi/issues/475#issuecomment-292734524

Programs such as Emby, should benefit vastly from this.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 9, 2017

RPi devices (all distros) will now install our compiled FFmpeg binary with OpenMAX enabled.

Fourdee referenced this issue Apr 9, 2017
+ DietPi-Software | FFmpeg: (RPi devices) now installs our binaries
built with HW encoding enabled:
https://github.com/Fourdee/DietPi/issues/869

+ DietPi-Software | VirtualHere: Now available for installation. Allows
you to access psyhically attached USB devices, over the network:
http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=6709#p6709
https://github.com/Fourdee/DietPi/issues/852
@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 9, 2017

Tests:

  • 🈯️ ARMv6
  • 🈯️ ARMv7
  • 🈯️ Stretch

Emby + OpenMAX enabled in transcode options:

  • 1080p, no stuttering 🥂
    image

@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 16, 2017

libmp3lame libfdk-aac libx264

root@DietPi:~# ffmpeg
ffmpeg version git-2017-04-14-3f1c527 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --enable-static --enable-gpl --enable-libx264 --enable-pthreads --enable-nonfree --enable-omx --enable-omx-rpi --enable-libfdk-aac --enable-libmp3lame
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 92.100 / 57. 92.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 84.101 /  6. 84.101
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100

Completed.

@Fourdee Fourdee closed this as completed Apr 16, 2017
@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 17, 2017

Needs recompile with prefix --prefix=/usr, else /usr/local/lib and export LD_LIBARY_PATH required.

@Fourdee Fourdee reopened this Apr 17, 2017
@WolfganP
Copy link

@Fourdee could you please share how can we install this custom version for testing? Thx in advance.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 18, 2017

@WolfganP
Once re-compiled (should be done tomorrow), testing branch install can be used. I'll let you know when its ready + instructions.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 19, 2017

@WolfganP

Ready for testing, you could install the updated FFmpeg binaries with simply:

INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/rpi/ffmpeg_rpi.7z'
wget "$INSTALL_URL_ADDRESS" -O package.7z
7z x -y package.7z -offmpeg_rpi
dpkg -i ffmpeg_rpi/*.deb
rm -R ffmpeg_rpi
rm package.7z

@Fourdee
Copy link
Collaborator Author

Fourdee commented Apr 21, 2017

Marking as completed.

@WolfganP
If you run any tests, please let me know if any issues.

@Fourdee Fourdee closed this as completed Apr 21, 2017
@WolfganP
Copy link

Will do @Fourdee

@Fourdee Fourdee mentioned this issue Apr 28, 2017
Fourdee referenced this issue Apr 28, 2017
**v149**
(28/04/17)

**New Device / Images:**
OrangePi Zero Plus 2 (H3) | https://github.com/Fourdee/DietPi/issues/876#issuecomment-294464779
OrangePi Win | https://github.com/Fourdee/DietPi/issues/875#issuecomment-296160956
OrangePi Prime | https://github.com/Fourdee/DietPi/issues/874#issuecomment-297675707

**Changes / Improvements / Optimizations:**

DietPi-Config | Display Rotation: New options for RPi HDMI output and Touchscreen devices. DietPi also calculates FB X/Y flip automatically, if required to utilize full screen under 90/270 rotations. Many thanks to @midwan for RPi touch screen testing: https://github.com/Fourdee/DietPi/issues/859

DietPi-Config | Hostname change: Now prompts for immediate reboot. This is to avoid potential issues with software installations and non-updated hostname on system. Many thanks to @9H5G for the suggestion: https://github.com/Fourdee/DietPi/issues/880

DietPi-Config | Audio > Sound Card: Updated hifiberry-dac to include HiFiBerry MiniAMP, many thanks to ta11 for the info: https://twitter.com/ta11/status/852599202186227712

DietPi-Config | Swapfile: Added ability to select Auto size (1GB - total RAM = size). Auto is now the default. Mainly to prevent out of memory errors on recent influx of 256MB boards.

DietPi-Obtain_Hw_Model | Optimized/reduced count of total HW_ARCH (from 21 to 10). Will improve performance in DietPi-Software due to reduced array size.

DietPi-RAMlog | PiHole: PiHole FTL log file is now excluded from 1 hour clear (preserves current day logs): https://github.com/Fourdee/DietPi/issues/868

DietPi-Software | Amiberry SDL2: Now available for installation. SDL2 Amiberry is currently in dev/testing. can be enabled with dietpi-autostart and selecting SDL2 option. Roughly 2x FPS increase over SDL1: https://github.com/Fourdee/DietPi/issues/850

DietPi-Software | VirtualHere: Now available for installation. Allows you to access psychically attached USB devices, over the network: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=6709#p6709

DietPi-Software | SABnzbd: Now available for installation. NZB download manager with web interface: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=6747#p6747

DietPi-Software | Spotify Connect Web: Now available for installation. Web interface, client and player for Spotify Premium: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=7013#p7013

DietPi-Software | SDL2: Now available for installation in additional linux software (RPi only).

DietPi-Software | FFmpeg: (RPi devices) now installs our binaries built with OpenMAX HW encoding enabled: https://github.com/Fourdee/DietPi/issues/869

DietPi-Software | AmiBerry: Renamed all references of uae4arm to AmiBerry: https://github.com/Fourdee/DietPi/issues/850

DietPi-Software | NAA Daemon: Updated to latest version (3.5.1-35). Many thanks to volpone for the heads up: http://dietpi.com/phpbb/viewtopic.php?f=11&t=1832

General | DietPi RPi Kernel: Now supports 384KHz audio output. Tested with Allo BOSS DAC and JustBoom-DAC: https://github.com/Fourdee/DietPi/issues/900#issuecomment-297775790

General | ARMbian built images: Console boot verbosity increase.

General | DietPi user: Now created for testing "dietpi". We are aiming to phase out root with our DietPi user in the future, currently, this account is for testing/debugging only. Default password is "dietpi" if "AUTO_Global_Password=" is unchanged in dietpi.txt: https://github.com/Fourdee/DietPi/issues/796

General | RPi Jessie: Image updated to latest

General | AmiBerry: Image updated to latest

**Bug fixes:**

DietPi-Process_Tool | Emby server: Now supported.

DietPi-CPU_Info | Now supports devices used in a freezer (- values) :D. Thanks to Gordon for reporting and testing this: http://dietpi.com/phpbb/viewtopic.php?f=11&t=1677&p=6800#p6790

DietPi-Software | Amiberry SDL1: NUM/CAPS LEDs are now fully functional: https://github.com/Fourdee/DietPi/issues/760#issuecomment-288496760
@MichaIng
Copy link
Owner

MichaIng commented Aug 2, 2018

@Fourdee
Maybe it's time to compile a new version? Even Debian Stretch repo is some subversions further via security patches: https://packages.debian.org/stretch/ffmpeg

V4.0.2 available on Buster repo (for testing) and GitHub sources of course: https://github.com/FFmpeg/FFmpeg/releases

@Fourdee
Copy link
Collaborator Author

Fourdee commented Aug 3, 2018

@MichaIng

Yep, agree.

Heres the old compile code I used, here for reference. I'll take a look at this when I can:

#FFmpeg ---------------------------------------------
#RPi tool chain
# cd /root
# git clone https://github.com/raspberrypi/tools.git --depth=1

# export CCPREFIX="/root/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"

apt-get install -y git checkinstall build-essential libomxil-bellagio-dev libmp3lame-dev libvorbis-dev libtheora-dev libspeex-dev yasm pkg-config libflac-dev libopenjpeg-dev -y
git clone https://github.com/FFmpeg/FFmpeg.git --depth=1
cd FFmpeg

#LIBFDK-AAC
apt-get install -y libfftw3-dev pkg-config autoconf automake libtool libtool-bin unzip
git clone https://github.com/mstorsjo/fdk-aac.git --depth=1
cd fdk-aac
./autogen.sh
./configure --enable-shared --prefix=/usr
make -j $(nproc --all)
checkinstall --nodoc --fstrans=yes #libfdk-aac
mv *.deb /root/
cd ..

#lame
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
tar xzvf lame-3.99.tar.gz
cd lame-3.99
./configure --enable-shared --prefix=/usr #--enable-static --host=arm-linux --prefix=${CCPREFIX}
make -j $(nproc --all)
mkdir -p /usr/share/doc/lame
checkinstall --nodoc --fstrans=yes #libmp3lame
mv *.deb /root/
cd ..


#x264
git clone git://git.videolan.org/x264 --depth=1
cd x264
./configure --disable-asm --enable-shared --prefix=/usr #--host=arm-linux --cross-prefix=${CCPREFIX} --enable-static --disable-asm --extra-cflags='-march=armv6' --extra-ldflags='-march=armv6'
make -j $(nproc --all)
checkinstall --nodoc --fstrans=yes #libx264
mv *.deb /root/
cd ..

#OpenMax headers
wget https://www.khronos.org/registry/OpenMAX-IL/api/1.1.2/OpenMAX_IL_1_1_2_Header.zip -O package.zip
unzip package.zip -d IL
rm package.zip


#REQUEST:  --enable -libass --enable-libx265

./configure --prefix=/usr --enable-static --enable-gpl --enable-libx264 --enable-pthreads --enable-nonfree --enable-omx --enable-omx-rpi --enable-libfdk-aac --enable-libmp3lame
make -j $(nproc --all)

mkdir -p /usr/share/ffmpeg
checkinstall --nodoc --install=no --fstrans=yes
mv *.deb /root/

#Install
#export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
apt-get install libx264-142 libmp3lame0

#FFmpeg ---------------------------------------------

@Fourdee Fourdee reopened this Aug 3, 2018
@Fourdee Fourdee modified the milestones: v149, v6.13 Aug 3, 2018
@Fourdee Fourdee self-assigned this Aug 3, 2018
@Fourdee Fourdee modified the milestones: v6.13, v6.14 Aug 13, 2018
@Fourdee Fourdee modified the milestones: v6.14, v6.15 Aug 20, 2018
@Fourdee Fourdee removed this from the v6.15 milestone Sep 12, 2018
@Fourdee Fourdee added this to the v6.16 milestone Sep 12, 2018
@Fourdee Fourdee modified the milestones: v6.16, Planned for implementation Sep 19, 2018
@MichaIng
Copy link
Owner

I guess Debian armhf packages do not (fully) support RPi?
E.g. https://packages.debian.org/buster/libx265-165

@MichaIng
Copy link
Owner

MichaIng commented May 7, 2019

The ffmpeg package from archive.raspberrypi.org repo got HW acceleration:

ffmpeg (7:3.2.12-1~deb9u1+rpt1) stretch; urgency=medium

  [ Dave Stevenson ]
  * avcodec/omx: Fix handling of fragmented buffers
  [ Serge Schneider ]
  * Add libraspberrypi0 dependency
  * Set --arch=armhf
  [ Arindam Chaudhuri ]
  * Enable Raspberry Pi HW acceleration

 -- Serge Schneider <[email protected]>  Fri, 25 Jan 2019 09:56:06 +0000

Same for the package from Buster branch:

ffmpeg (7:4.1-1+rpt1) buster; urgency=medium

  [ Dave Stevenson ]
  * avcodec/omx: Fix handling of fragmented buffers
  [ Serge Schneider ]
  * Add libraspberrypi0 dependency
  * Set --arch=armhf
  [ Arindam Chaudhuri ]
  * Enable Raspberry Pi HW acceleration

 -- Serge Schneider <[email protected]>  Wed, 06 Feb 2019 14:17:15 +0000

These packages are preferred by APT over the ones from Raspbian repo (identical to Debian repo), so I suggest we revert to APT install on RPi as well.

However some quick test would be great, including AAC/x264/x265.

@MichaIng
Copy link
Owner

Included and merged: #2875

Actually since the repo version is newer, an APT upgrade must have upgraded the package already (present since end of January), so it's just to avoid installing our own compiled package first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants