Skip to content

Instantly share code, notes, and snippets.

@catalsdevelop
Forked from Akagi201/ffmpeg-cmd.md
Created May 24, 2017 03:28
Show Gist options
  • Save catalsdevelop/150841f407daed817e55afce27bc5436 to your computer and use it in GitHub Desktop.
Save catalsdevelop/150841f407daed817e55afce27bc5436 to your computer and use it in GitHub Desktop.

element stream to ts

  • ffmpeg -i audio.aac -i ch2.h264 -acodec copy -vcodec copy -f mpegts out.ts

rtsp 2 rtmp

  • ffmpeg -rtsp_transport tcp -i rtsp://fuck.com/fuck/fuck -c copy -f flv rtmp://shit.com/shit/shit

截图片

  • ./ffmpeg -y -err_detect ignore_err -i "rtmp://uplive.b0.upaiyun.com/live/loading timeout=10" -f image2 -vframes 1 a.jpg
  • ./ffmpeg -y -err_detect ignore_err -i "rtmp://uplive.b0.upaiyun.com/live/loading live=1 timeout=10" -f image2 -vframes 1 a.jpg

推流图片

  • ./ffmpeg -loop 1 -i akhead.jpg -r 10 -f flv rtmp://uplive.v0.upaiyun.com/live/english

查看 ffmpeg 全部帮助

  • ffmpeg --help full

推纯音频

  • ffmpeg -re -i xxx.aac -vn -acodec copy -f flv -y rtmp://xxxx

实时转低码率

  • ffmpeg -i rtmp://10.0.5.135/uplive.b0.upaiyun.com/live/123 -b 1000k -s 960:540 -f flv rtmp://10.0.5.132/uplive.v0.upaiyun.com/live/small

循环推流

for((;;)); do \
    ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/hightest_h1080p.mov \
    -vcodec copy -acodec copy \
    -f flv -y rtmp://127.0.0.1:1935/live/livestream; \
    sleep 1; \
done

纯 AAC 推流

  • ffmpeg -re -i time.aac -bsf:a aac_adtstoasc -c copy -f flv rtmp://uplive.b0.upaiyun.com/live/english

转码为低码率

  • ffmpeg -i time.flv -c libx264 -profile:v high -preset:v slow -b:v 300k -s 640x480 -r 25 -acodec libfdk_aac -ac 2 -b:a 48k -ar 44100 -y time.300kbps.flv

切割mp4

  • ffmpeg -ss 00:00:00 -i mpeg4conformance.mp4 -vcodec copy -acodec copy -t 00:00:10 o.mp4

解析所有的帧

webcam

常用命令

下载m3u8视频

  • ffmpeg -i M3U8 URL -c copy mpegts.ts

桌面直播

  • ffmpeg -f x11grab -follow_mouse centered -r 100 -s cif -i :0.0 -f flv $RTMP_PUSH_URL

转h.264裸流文件

  • -acodec none

watermark

使用FFMPEG发布RTSP流

  • 上传: ffmpeg -i a.mp4 -vcodec libx264 -f rtsp rtsp://127.0.0.1:5050/ok
  • 接收: ffmpeg -rtsp_flags listen -f rtsp -i rtsp://127.0.0.1:5050/ok b.mp4

压制

转码到webm

webcam capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment