Media format conversion using ffmpeg

1. The installation methods of CentOS 6 and 7 are different, as follows:

Before installation, you need to install the epel extension source first

yum -y install epel-release

CentOS 6 is relatively simple, you can install it directly after installing the yum source:

su -c 'yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-6.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-6.noarch.rpm'

yum -y install ffmpeg ffmpeg-devel

And CentOS 7 needs to install additional extension sources:

su -c 'yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm'

rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

yum -y install ffmpeg ffmpeg-devel

2. Transfer to HLS

/usr/bin/ffmpeg -i 3.wmv -c:v libx264 -c:a aac -strict -2 -f hls -hls_list_size 0 -hls_time 5 3/3.m3u8

Move 3.wmv ​​to the 3 directory (choose to create a directory), the index file name is 3.m3u8

4. Convert to mp4

/usr/bin/ffmpeg  -i 3.wmv -c:v libx264 -c:a aac -s 720x480 -y -strict -2 3.mp4

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325345266&siteId=291194637