Add support via ffmpeg. See https://john.ly/stream-rtmp/
$sudo apt-get update
$sudo apt-get upgrade
Compiling libfdk-aac: https://trac.ffmpeg.org/wiki/CompilationGuide/Quick/libfdk-aac
Installing ffmpeg: https://sebastian.korotkiewicz.eu/2016/09/30/ffmpeg-on-raspbian-raspberry-pi/ (but see below)
We currently transfer the uncompressed files from the Raspberry Pi capture stations to the Hoffman2 high-performance computing cluster at UCLA, which processes the files and sends them to the NewsScape search engines and archival servers. However, in some cases it may be necessary or desirable to perform the compression locally, either with software codecs or with the hardware codec built into the Raspberry Pi.
The Raspberry Pi has a hardware compression chip. To support it, build a custom version of ffmpeg as follows.
First activate the source repositories in /etc/apt/sources.list by adding this:
deb-src http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/ jessie main contrib non-free rpi
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb-src http://www.deb-multimedia.org jessie main non-free
Install the build dependencies:
Get ffmpeg, note the git version number, and configure:
At this point, build a deb package or install locally.
The advantage of creating a deb package (cf. details) is that you can install it on multiple computers. Red Hen followed this procedure and has a ready package that provides hardware encoding through ffmpeg:
Set the version to the output of RELEASE and ./version.sh -- something like 20:3.2+git-2017-03-27-d7896e9, consisting of:
Note that the epoch will not be included in the deb file name, so the version number used above will create a package called ffmpeg_3.2+git-2017-03-27-d7896e9-1_armhf.deb. However, the epoch will show and have the desired effect when installing the package.
This package can now be copied to other RPis. Install it along with the libx264-148 package from Raspbian Stretch (the name of the next version release):
In addition to being portable, an installed package is also easy to uninstall and upgrade.
Verify the hardware encoder is supported by ffmpeg:
First give the user access to the hardware encoder:
Log out of that user (all screen windows, out of the RPi) and then log back in. Otherwise the hardware encoder cannot be accessed and we get the error "failed to open vchiq instance."
You can then use the ts2mp4-single-02.sh script and encode a one-hour video in about 20 minutes:
This is implemented in the script check-cc-single-02.sh. The quality is decent, but not as good as software-encoded files; the hardware encoder is poor at low-contrast motion, which affects faces.
This should only be done on an experimental computer where we occasionally reinstall a fresh operating system. Installing ffmpeg in this way makes it very hard to uninstall it.
For an experimental build on a single computer, we first got the latest x264 and fdk-aac and built them:
Then we built ffmpeg:
This version cannot be copied to other computers.
@redhenlab > d. The Cognitive Core: Research Topics in Red Hen > The Barnyard of Possible Specific Projects >