X264_TMOD Linux 编译记录

X264_TMOD Linux 编译记录

IT, 其他

平时用的x264编码器有分普通x264、tmod、kmod。

这些编码器都有现成的win平台可执行文件,但是当我想要在Linux平台上使用的时候,那就需要自行编译了。

由于编译根据Linux发行版本、编译环境不同可能会发生各种问题。

笔记来源于http://mom.blog.ustc.edu.cn/?p=163但是由于年代久远(也就2013年至今),代码等等发生了变化,全盘按照此教程编译一定是失败的。于是我给出了如下可能的编译方案

编译平台Debian 8

 

1.依赖准备:


sudo apt-get install autoconf automake git libtool nasm build-essential pkg-config libssl-dev zlib1g-dev

注:gcc版本最好更新,否则有可能出现报错

2.建立代码库文件夹

mkdir ~/ffmpeg_sources

3.yasm安装或者yasm编译

a.安装:

sudo apt-get install yasm

b.编译:

cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean

4.ffmpeg编译

cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-nonfree
make
make install
make distclean

5.编译ffms2

cd ~/ffmpeg_sources
git clone https://github.com/FFMS/ffms2.git
cd ffms2
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-shared
make
make install
make distclean

6.编译l-smash

cd ~/ffmpeg_sources
git clone https://github.com/l-smash/l-smash.git
cd l-smash/
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install-lib
install -m 644 ./importer/importer.h ~/ffmpeg_build/include/lsmash_importer.h
make distclean

7.编译x264_tMod

首先要准备好文件x264_tMod-clone.sh,参考 http://astrataro.wordpress.com 需要翻墙,全文见附录,假设x264_tMod-clone.sh已经下载到~/ffmpeg_sources目录下

cd ~/ffmpeg_sources
sh x264_tMod-clone.sh
cd x264_tMod/
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --chroma-format=420 --bit-depth=8 --enable-strip --disable-audio --disable-opencl
make
make install
make distclean

 

附录

content of x264_tMod-clone.sh

这个修改自原Shell脚本,由于年久失修,DarkShikari的x264-devel已经404了,临时找来一个可以用的。

#!/usr/bin/env bash
# Originally for L-SMASH project.
# Modified for tMod.
# I do not claim any further copyright.
# This file is part of L-SMASH project.
# http://github.com/silverfilain/x264_L-SMASH
# Copyright (C) 2010-2013 L-SMASH project
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Mar. 12, 2013 Lucien# Simplified for tMod.# Aug. 26, 2010 Takashi Hirata
# Initial release for unofficial repository of L-SMASH.
# Sep. 20, 2010 Takashi Hirata
# Change cloning of official repo to optional.
# Add help.
# Remove pushurl settings.
working_dir=x264_tMod
tmod_repo=git://github.com/astrataro/x264_tMod.git
orig_repo=git://github.com/amefs/x264-devel.git
lsms_repo=git://github.com/silverfilain/x264_L-SMASH.git
orig_remo=porigin
lsms_remo=lorigin
fatal(){
echo -n "ERROR: "
echo $1 exit 1
}
#### cloning ####
echo "INFO: ==== CLONING FROM $tmod_repo"
git clone $tmod_repo $working_dir || fatal "failed to clone repo $tmod_repo"
cd $working_dir
git remote add $orig_remo $orig_repo || fatal "failed to clone repo $orig_repo."
git remote add $lsms_remo $lsms_repo || fatal "failed to clone repo $lsms_repo."
git fetch $orig_remo || fatal "failed to fetch from $orig_repo."
git fetch $lsms_remo || fatal "failed to fetch from $lsms_repo."
git branch plain $orig_remo/master || fatal "failed to create branch plain."
git branch kaudio $lsms_remo/kaudio || fatal "failed to create branch kaudio."
git branch lsmash $lsms_remo/lsmash || fatal "failed to create branch lsmash."
echo "INFO: finished."
echo "INFO: use 'git branch' to check your branch setup."

根据上面方案,最终测试,最后的x264任然无法正常编译,因此搜寻了新的替代方案:

Fork了一个含有tmod的x264代码,编译出来有aq-mode3
https://github.com/jpsdr/x264

 

IT, Linux, tmod, x264
上一篇文章
迅雷路由换血记-不死cfe刷写教程
下一篇文章
BDMV结构认识与内容抽取

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Fill out this field
Fill out this field
请输入有效的电子邮箱地址。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

keyboard_arrow_up