ffmpeg相关技巧
Easul Lv6

ffmpeg

aac转mp3

BASH
1
2
3
4
5
# -i 输入的 aac 文件
# -c:a 指定编码器
# -q:a 指定音频质量,从 高 到 低 为 0-9
# output.mp3 输出文件名
ffmpeg -i input.aac -c:a libmp3lame -q:a 2 output.mp3

视频裁剪

BASH
1
2
# 将输入视频从某秒到某秒进行剪辑
ffmpeg -i input.mp4 -ss 00:00:04 -to 00:37:30 output.mp4

视频内录

以下操作为 windows 平台的视频内录

BASH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 下载ffmpeg
# 下载链接为:https://github.com/BtbN/FFmpeg-Builds/releases
# 需要注册Screen Capturer Recorder的两个dll
# 在ffmpeg的根目录下,建立dll文件夹,将下边链接的两个dll放到该文件夹下,然后注册dll
# 链接为:https://wwu.lanzout.com/iivzq04y7zfg
regsvr32 audio_sniffer-x64.dll
regsvr32 screen-capture-recorder-x64.dll
# 使用ffmpeg查看当前能够使用的设备
# cam:摄像头
# screen-capture-recorder:桌面屏幕捕获器
# audio:声音设备
ffmpeg -list_devices true -f dshow -i dummy
# 录制屏幕和声音
C:\software\ffmpeg\bin\ffmpeg -f gdigrab -i desktop -f dshow -i audio="virtual-audio-capturer" c:\Users\Test\Desktop\test.mp4
# 脚本中可以用如下命令
start /min C:\software\ffmpeg\bin\ffmpeg -f gdigrab -i desktop -f dshow -i audio="virtual-audio-capturer" c:\Users\Test\Desktop\test.mp4

参考

下载m3u8为mp4

BASH
1
2
# 下载视频
ffmpeg -i http://www.china.com/video/pla.m3u8 -c copy /home/chinese/mydl_video.mp4

ffplay

ffplay播放直播源音频

BASH
1
ffplay -vn -nodisp "http://localhost/live/8/playlist.m3u8"
 评论