[root@VM-16-6-centos ~]# ffmpeg -re -i "/root/ZLMediaKit/release/linux/Debug/www/record/rtp/0BEBE85B/2021-11-10/21-33-37.mp4" -vcodec h264 -acodec aac -f flv rtmp://127.0.0.1/live/test
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (GCC)
configuration:
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/ZLMediaKit/release/linux/Debug/www/record/rtp/0BEBE85B/2021-11-10/21-33-37.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2021-11-10T13:33:37.000000Z
Duration: 00:20:32.12, start: 0.000000, bitrate: 691 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080, 690 kb/s, 25.02 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
creation_time : 2021-11-10T13:33:37.000000Z
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_v4l2m2m))
Press [q] to stop, [?] for help
[h264_v4l2m2m @ 0x2f2c640] Could not find a valid device
[h264_v4l2m2m @ 0x2f2c640] can't configure encoder
#下载x264源码编译生成libx264.so库,重新编译FFmpeg并将x264添加进去
[root@VM-16-6-centos ~]# git clone https://code.videolan.org/videolan/x264.git
cd x264 //进入x264源码文件目录下
./configure --enable-shared
make
sudo make install
sudo cp /usr/local/lib/libx264.so.164 /lib //生成文件的默认路径为:/usr/local/lib
cd ffmpeg //进入ffmpeg源码文件目录下
./configure --enable-shared --disable-yasm --enable-libx264 --enable-gpl --prefix=/home/jiajia/ffmpeg-x64
make
make install
./configure --enable-shared编译想264报错Found no assembler
Minimum version is nasm-2.13 处理方式如下
Linux下编译x264 If you really want to compile without asm, configure with --disable-asm 的解决办法
下载 nasm
https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/
解压
tar -zxvf nasm-2.13.03.tar.gz
进入目录
cd nasm-2.13.03
安装即可
./configure
make
make install
安装nasm之后再进入x264目录
./configure