・2023/01/15
【2023年】Raspberry Piで高音質な fdk-aacを有効にした FFmpegをビルドする方法
(ラズパイで Fraunhofer FDK AACが使える FFmpegを自分でコンパイルしてインストールする方法)
Tags: [Raspberry Pi], [電子工作]
● Raspberry Pi 3 Model Bを遂に購入
Raspberry Pi3 Model B RPI2 RPI3
大人気の CPUボードの Raspberry Piに WiFiと Bluetoothが搭載されたモデルが新発売となりました。
以前から Raspberry Pi 2を買おうかどうか迷っていましたが、Raspberry Pi 3 Model Bの発売を機に購入を決意してラズベリアンになる事にしました。
※ ラズパイの OS Raspbianはバージョンが上がる毎に過去の版と OSの内部の作りが変わり、過去に書かれた製作記事(例えば Raspbian Wheezyの時代の記事)がそのままではエラーが出たりして動かない事が有ります。
※ 当方のホームページのラズパイ記事は全て Raspberry Pi 3 Model Bと Raspbian Jessieの組み合わせで動作確認をしております。
(ただし、将来的に新しい Raspbian OSが出た場合に、当方の Raspbian Jessieを基にした内容がそのままでは動かない可能性が有ります。)
※ 2017/08/16から Raspbian OSは Raspbian Jessieから Raspbian Stretchに変わりました。
※ 2019/06/20から Raspbian OSは Raspbian Stretchから Raspbian Busterに変わりました。
Download Raspbian for Raspberry Pi
ちなみに、歴代のバージョンと名称は
Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
Debian 7 | Wheezy | 2013~2016 | | |
Debian 6.0 | Squeeze | 2011~2014 | | |
Debian GNU/Linux 5.0 | Lenny | 2009~2012 | | |
● Windowsで高音質な fdk-aacを有効にした動画処理アプリ FFmpegをビルドする方法
・[UPDATE] 2023/10/15
【2023年】Windowsで高音質な fdk-aacを有効にした FFmpegをビルドする方法
Windowsで Fraunhofer FDK AACが使える FFmpegを自分でコンパイルしてインストールする方法
● Raspberry Pi3 Jessieで FFmpegをセルフコンパイルする方法
昔の記事。
・2016/05/26
Raspberry Pi 3 Model Bで動画処理アプリ FFmpegをコンパイルする方法
ラズパイ3で動画音声変換処理プログラム FFmpegをセルフコンパイルしてインストールする方法
● Raspberry Piで高音質な fdk-aacを有効にした動画処理アプリ FFmpegをコンパイルする方法
ラズパイで Fraunhofer FDK AACが使える FFmpegを自分でコンパイルしてインストールする方法
FFmpeg公式のビルド方法
Compile FFmpeg for Ubuntu, Debian, or Mint
FFmpeg公式のビルド方法でそのままビルドできました。
Fraunhofer FDK AACは高音質で有名です。
(と言うか、FFmpegに内蔵の AACエンコーダが腐っている)
バイナリが配布されている通常の FFmpegに内蔵の AACエンコーダ(Native FFmpeg AAC Encoder)よりも段違いに音が良いです。
プラットフォーム - Fraunhofer IIS FDK AAC
FFmpeg Encode/AAC
● apt-getでインストールできる FFmpegの AACエンコーダは低音質
$ sudo apt-get -y install ffmpeg
$ ffmpeg -version
ffmpeg version 4.3.5-0+deb11u1+rpt2 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Raspbian 10.2.1-6+rpi1)
$ sudo apt-get -y purge ffmpeg
# Purging configuration files for ffmpeg (7:4.3.5-0+deb11u1+rpt2) ...
● ラズパイ用の FFmpegをビルドする
$ uname -a
Linux raspberrypi 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux
# Get the Dependencies
# These are packages required for compiling, but you can remove them when you are done if you prefer:
sudo apt-get update -qq
sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
meson \
ninja-build \
pkg-config \
texinfo \
wget \
yasm \
zlib1g-dev
# In your home directory make a new directory to put all of the source code and binaries into:
cd
mkdir -p ~/ffmpeg_sources ~/bin
# Compilation & Installation
# NASM
sudo apt-get install nasm
# libx264
sudo apt-get install libx264-dev
# libx265
sudo apt-get install libx265-dev libnuma-dev
# libvpx
sudo apt-get install libvpx-dev
# libfdk-aac
sudo apt-get install libfdk-aac-dev
# libopus
sudo apt-get install libopus-dev
# libaom
sudo apt-get install libaom-dev
# libsvtav1
sudo apt-get install libsvtav1-dev
# libdav1d
sudo apt-get install libdav1d-dev
# libvmaf
sudo apt-get install libvmaf-dev
# 上記を一括で実行
sudo apt-get -y install nasm libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libopus-dev libaom-dev libsvtav1-dev libdav1d-dev libvmaf-dev
E: Unable to locate package libfdk-aac-dev
E: Unable to locate package libsvtav1-dev
E: Unable to locate package libvmaf-dev
# deb-multimedia
# https://deb-multimedia.org/
sudo echo "deb http://www.deb-multimedia.org bullseye main non-free" >> /etc/apt/sources.list
-bash: /etc/apt/sources.list: Permission denied
echo "deb http://www.deb-multimedia.org bullseye main non-free" | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5C808C2B65558117
sudo apt-get update
sudo apt-get -y install libfdk-aac-dev
# Setting up libfdk-aac2:armhf (1:2.0.2-dmo2) ...
# Setting up libfdk-aac-dev:armhf (1:2.0.2-dmo2) ...
# ERROR: gnutls not found using pkg-config
sudo apt-get -y install libunistring-dev
● FFmpegで FDK AACを使う場合の引数指定
-c:a libfdk_aac
or
-codec:a libfdk_aac
ffmpeg -i input.wav -codec:a libfdk_aac -vbr 5 -ar 48000 output.m4a
# FFmpeg
cd ~/ffmpeg_sources
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-gnutls \
--enable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libsvtav1 \
--enable-libdav1d \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree
# 2~3分程度待つ
# License: nonfree and unredistributable
# Build FFmpeg
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r
# current shell session to recognize the new ffmpeg location:
source ~/.profile
$ ~/bin/ffmpeg -version
ffmpeg version N-109600-gb37795688a Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Raspbian 10.2.1-6+rpi1)
configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/pi/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 57. 44.100 / 57. 44.100
libavcodec 59. 56.100 / 59. 56.100
libavformat 59. 35.100 / 59. 35.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 53.100 / 8. 53.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
libpostproc 56. 7.100 / 56. 7.100
$ ffmpeg -h
ffmpeg version N-109600-gb37795688a Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Raspbian 10.2.1-6+rpi1)
configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/pi/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 57. 44.100 / 57. 44.100
libavcodec 59. 56.100 / 59. 56.100
libavformat 59. 35.100 / 59. 35.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 53.100 / 8. 53.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
libpostproc 56. 7.100 / 56. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Getting help:
-h -- print basic options
-h long -- print more options
-h full -- print all options (including all format and codec specific options, very long)
-h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
See man ffmpeg for detailed description of the options.
Print help / information / capabilities:
-L show license
-h topic show help
-? topic show help
-help topic show help
--help topic show help
-version show version
-buildconf show build configuration
-formats show available formats
-muxers show available muxers
-demuxers show available demuxers
-devices show available devices
-codecs show available codecs
-decoders show available decoders
-encoders show available encoders
-bsfs show available bit stream filters
-protocols show available protocols
-filters show available filters
-pix_fmts show available pixel formats
-layouts show standard channel layouts
-sample_fmts show available audio sample formats
-dispositions show available stream dispositions
-colors show available color names
-sources device list sources of the input device
-sinks device list sinks of the output device
-hwaccels show available HW acceleration methods
Global options (affect whole program instead of just one file):
-loglevel loglevel set logging level
-v loglevel set logging level
-report generate a report
-max_alloc bytes set maximum size of a single allocated block
-y overwrite output files
-n never overwrite output files
-ignore_unknown Ignore unknown stream types
-filter_threads number of non-complex filter threads
-filter_complex_threads number of threads for -filter_complex
-stats print progress report during encoding
-max_error_rate maximum error rate ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
Per-file main options:
-f fmt force format
-c codec codec name
-codec codec codec name
-pre preset preset name
-map_metadata outfile[,metadata]:infile[,metadata] set metadata information of outfile from infile
-t duration record or transcode "duration" seconds of audio/video
-to time_stop record or transcode stop time
-fs limit_size set the limit file size in bytes
-ss time_off set the start time offset
-sseof time_off set the start time offset relative to EOF
-seek_timestamp enable/disable seeking by timestamp with -ss
-timestamp time set the recording timestamp ('now' to set the current time)
-metadata string=string add metadata
-program title=string:st=number... add program with specified streams
-target type specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad audio pad
-frames number set the number of frames to output
-filter filter_graph set stream filtergraph
-filter_script filename read stream filtergraph description from a file
-reinit_filter reinit filtergraph on input parameter changes
-discard discard
-disposition disposition
Video options:
-vframes number set the number of video frames to output
-r rate set frame rate (Hz value, fraction or abbreviation)
-fpsmax rate set max frame rate (Hz value, fraction or abbreviation)
-s size set frame size (WxH or abbreviation)
-aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-display_rotation angle set pure counter-clockwise rotation in degrees for stream(s)
-display_hflip set display horizontal flip for stream(s) (overrides any display rotation if it is not set)
-display_vflip set display vertical flip for stream(s) (overrides any display rotation if it is not set)
-vn disable video
-vcodec codec force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff set initial TimeCode value.
-pass n select the pass number (1 to 3)
-vf filter_graph set video filters
-ab bitrate audio bitrate (please use -b:a)
-b bitrate video bitrate (please use -b:v)
-dn disable data
Audio options:
-aframes number set the number of audio frames to output
-aq quality set audio quality (codec-specific)
-ar rate set audio sampling rate (in Hz)
-ac channels set number of audio channels
-an disable audio
-acodec codec force audio codec ('copy' to copy stream)
-af filter_graph set audio filters
Subtitle options:
-s size set frame size (WxH or abbreviation)
-sn disable subtitle
-scodec codec force subtitle codec ('copy' to copy stream)
-stag fourcc/tag force subtitle tag/fourcc
-fix_sub_duration fix subtitles duration
-canvas_size size set canvas size (WxH or abbreviation)
-spre preset set the subtitle options to the indicated preset
Tags: [Raspberry Pi], [電子工作]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
【2023年】Windowsで高音質な fdk-aacを有効にした FFmpegをビルドする方法
Windowsで Fraunhofer FDK AACが使える FFmpegを自分でコンパイルしてインストールする方法
Raspberry Pi 3 Model Bで動画処理アプリ FFmpegをコンパイルする方法
ラズパイ3で動画音声変換処理プログラム FFmpegをセルフコンパイルしてインストールする方法
【2020年版】NVIDIA Jetson Nano対応の FFmpegをビルドする手順
NVIDIA Jetson Nano対応の FFmpegをビルドする手順、x264と x265にも対応
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2023 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_compile_ffmpeg_enable_fdk_aac/