av1 hevc H264 有用的网址

转码相关:

https://evilmartians.com/chronicles/better-web-video-with-av1-codec

https://www.cnblogs.com/tinywan/p/6404411.html

https://trac.ffmpeg.org/wiki/Encode/H.264

https://evilmartians.com/chronicles/better-web-video-with-av1-codec

https://magiclen.org/vcodec/

https://magiclen.org/image-differencer/

https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding

https://en.wikipedia.org/wiki/Advanced_Video_Coding

https://en.wikipedia.org/wiki/AV1

无损媒体资源地址:

https://media.xiph.org/

https://www.streamingmedia.com/Articles/Editorial/Featured-Articles/At-the-Battle-of-the-Codecs-Answers-on-AV1-HEVC-and-VP9-128213.aspx?utm_source=related_articles&utm_medium=gutenberg&utm_campaign=editors_selection

https://www.muvi.com/blogs/best-video-codec-for-streaming.html

https://aomedia.googlesource.com/aom

https://trac.ffmpeg.org/wiki/CompilationGuide

AV1 spec 地址:

https://aomedia.org/av1-features/get-started/

AV1-ISO-Base-Media-File-Format-Binding-Specification

av1-spec

 

质量评估:

https://magiclen.org/ffmpeg-psnr-ssim/

https://github.com/Netflix/vmaf

https://medium.com/netflix-techblog/toward-a-practical-perceptual-video-quality-metric-653f208b9652

https://www.jianshu.com/p/58f73b38a2ca

https://testerhome.com/topics/11888

https://juejin.im/post/5c1ca976e51d45436e1b94f6

https://github.com/Netflix/vmaf

https://zhuanlan.zhihu.com/p/23536648

https://www.jianshu.com/p/b97e4d15a400

http://yunxin.163.com/blog/video14-0809/

https://testerhome.com/topics/19932

 

 

ffmpeg 编译 AV1 x264 x265转码

代码下载:

1.下载ffmpeg code。

git clone https://github.com/FFmpeg/FFmpeg.git

目前最新版本branch为:

remotes/origin/release/4.2    checkout 到4.2分支。

2.下载AV1  source code 。

git clone https://aomedia.googlesource.com/aom

使用master 分支,remotes/origin/master

3.下载 x264 Source Code

git clone https://code.videolan.org/videolan/x264.git

使用 master 线 remotes/origin/master

4.下载x265 Source Code
hg clone http://hg.videolan.org/x265

 

编译库依赖库:

1.AV1 编译

假设代码位置为/*/aom  。

mkdir aom_build

drwxr-xr-x 19 xw xw 4096 11月 12 15:27 aom/
drwxr-xr-x 9 xw xw 4096 11月 12 19:34 aom_build/

cd aom_build

cmake ../aom 类似如下输出说明configure 成功。

aom_configure: Detected CPU: x86_64
Configuring done
Generating done
Build files have been written to: /mydata/mywork/mycode/media/aom_build

make -j8

sudo make install

2.编译 x264

假设代码存放位置/*../x264

cd x264

./configure –enable-shared –enable-static

make -j8

sudo make install

3.编译x265

假设代码存放位置/*…./x265/

mkdir x265_build

cd x265_build

cmake ../x265

make -j8

sudo make install

4 编译ffmpeg 。

cd ffmpeg

./configure –enable-libx264 –enable-libx265 –enable-libaom –disable-doc –enable-pic –extra-cflags=-fPIC –enable-gpl

make -j8

sudo  make install

 

 

 

 

ffmpeg为视频添加时间戳

--enable-debug=3 --disable-doc --disable-optimizations --enable-pic --extra-cflags=-fPIC --enable-openssl --enable-libx264 --enable-libx265 --enable-gpl --enable-nonfree --enable-libfreetype

配置ffmpeg –enable-libfreetype 选项。

使用如下命令进行转码:

ffmpeg -i inputfile -vf "drawtext=fontfile=/usr/share/fonts/truetype/wqy/wqy-microhei.ttc: x=40: y=40: fontcolor=white: fontsize=100: box=1:boxborderw=20: boxcolor=0x00000000@1: text=%{n}" -vcodec libx264 -r 15  ./outputfilename.mkv

 

ffmpeg生成不同数据格式的像素rawdata

convert -size 128x128 xc:#ffffff ffffff_128_128.jpg

上面命令生成纯白图片。

ffmpeg  -pix_fmts | grep IO | awk '{print $2}' > pix_fmts_list

上面命令生成 pix format列表,删除开头无效行内容。

pix_fmts_list

echo "set -x" >> command.sh
cat pix_fmts_list | xargs -i echo "ffmpeg  -i ffffff_128_128.jpg  -pix_fmt {}   ffffff_128_128_{}.yuv" >> command.sh
chmod 777 command.sh

command

执行上面脚本,生成脚本的原因是因为方便跟踪出错的命令,也可以通过下面命令直接生成。

cat pix_fmts_list | xargs -i ffmpeg  -i ffffff_128_128.jpg  -pix_fmt {}   ffffff_128_128_{}.yuv

通过如下命令可使用ffplay进行播放rawdata 。

ffplay -f rawvideo -pixel_format gray  -video_size 128x128  fffff_128_128_gray.yuv

 

ffmpeg创建多个program的 ts流

 	
-program [title=title:][program_num=program_num:]st=stream[:st=stream...](output)
Creates a program withthe specified title, program_numand adds the specified stream(s)to it.

ffmpeg为视频添加多个音轨

使用上面生成的文件,配合如下命令:

ffmpeg -i ffffff_1920X1080.jpg -c:v libx265 ffffff_x265_1920x1080.ts

ffmpeg -i ffffff_with_audio.ts -i ffffff_x265_1920x1080.ts -map 0:0 -map 0:1 -map 1:0 -map 0:2 -c copy -program title=x264:program_num=1:st=0:st=1 -program title=x265:program_num=2:st=2:st=3 -f mpegts tow_program_audio.ts

Input #0, mpegts, from 'tow_program_audio.ts':
  Duration: 00:00:00.04, start: 1.400000, bitrate: 1203 kb/s
  Program 1 
    Metadata:
      service_name    : x264
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High 4:4:4 Predictive) ([27][0][0][0] / 0x001B), yuvj444p(pc, progressive), 12x12 [SAR 1:1 DAR 1:1], 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, mono, fltp, 96 kb/s
  Program 2 
    Metadata:
      service_name    : x265
      service_provider: FFmpeg
    Stream #0:2[0x102]: Video: hevc (Rext) (HEVC / 0x43564548), gray(tv), 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 90k tbn, 25 tbc
    Stream #0:3[0x103]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, mono, fltp, 63 kb/s

 

ffmpeg为视频添加多个音轨

使用如下命令从图片生成ts视频,然后添加3个不同格式的音轨:

参考文章地址:

https://code-examples.net/zh-TW/q/b3bda2

convert -size 12x12 xc:#ffffff ffffff.jpg 
ffmpeg -i ffffff.jpg -c:v libx264 ffffff.ts
fmpeg -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=0.05" -c:a pcm_s16le test.wav
ffmpeg -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=0.05" -c:a ac3  test_ac3.ts
ffmpeg -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=0.05" -c:a aac  test_aac.ts
ffmpeg -i ffffff.ts -i test_ac3.ts -i test_aac.ts -i test.wav -map 0 -map 1 -map 2 -map 3 -codec copy -shortest ffffff_with_audio.ts

 

VLC debug 模式编译

./configure –enable-debug –disable-optimizations –disable-sout PKG_CONFIG_PATH=/home/xw/mywork/Qt/5.11.2/gcc_64/lib/pkgconfig

find -name Makefile | xargs -i sed -i “s/-g -O2/-g3 -O0/” {}

find -name Makefile | xargs -i grep -iH “-g3 ” {}