ffmpeg command

1, the file is sent as a live broadcast

ffmpeg -re -i localFile.mp4 -c copy -f flv rtmp://server/live/streamName 

2. Save the file to a local broadcast media

ffmpeg -i rtmp://server/live/streamName -c copy dump.flv 

3, which will be a live stream, use h264 video compression, audio unchanged, sent to another live streaming service

ffmpeg -i rtmp://server/live/originalStream -c:a copy -c:v libx264 -vpre slow -f flv rtmp://server/live/h264Stream

4. in which a live streaming, video switch h264 compression, audio compression faac use, to the other live streaming service

ffmpeg -i rtmp://server/live/originalStream -c:a libfaac -ar 44100 -ab 48k -c:v libx264 -vpre slow -vpre baseline -f flv rtmp://server/live/h264Stream

5, which will be a live streaming video unchanged audio switch faac is compressed and sent another live streaming service

ffmpeg -i rtmp://server/live/originalStream -acodec libfaac -ar 44100 -ab 48k -vcodec copy -f flv rtmp://server/live/h264_AAC_Stream

6, a high-definition streaming, copied to several different definition video stream to re-release, in which the audio unchanged

ffmpeg -re -i rtmp://server/live/high_FMLE_stream -acodec copy -vcodec x264lib -s 640×360 -b 500k -vpre medium -vpre baseline rtmp://server/live/baseline_500k -acodec copy -vcodec x264lib -s 480×272 -b 300k -vpre medium -vpre baseline rtmp://server/live/baseline_300k -acodec copy -vcodec x264lib -s 320×200 -b 150k -vpre medium -vpre baseline rtmp://server/live/baseline_150k -acodec libfaac -vn -ab 48k rtmp://server/live/audio_only_AAC_48k

7, the same function, except that -x264opts options

ffmpeg -re -i rtmp://server/live/high_FMLE_stream -c:a copy -c:v x264lib -s 640×360 -x264opts bitrate=500:profile=baseline:preset=slow rtmp://server/live/baseline_500k -c:a copy -c:v x264lib -s 480×272 -x264opts bitrate=300:profile=baseline:preset=slow rtmp://server/live/baseline_300k -c:a copy -c:v x264lib -s 320×200 -x264opts bitrate=150:profile=baseline:preset=slow rtmp://server/live/baseline_150k -c:a libfaac -vn -b:a 48k rtmp://server/live/audio_only_AAC_48k

8, the current camera and audio capture through DSSHOW, after video h264, audio compression release faac

ffmpeg -r 25 -f dshow -s 640×480 -i video=”video source name”:audio=”audio source name” -vcodec libx264 -b 600k -vpre slow -acodec libfaac -ab 128k -f flv rtmp://server/application/stream_name

9, a JPG image compression cycle through h264 mp4 video output

ffmpeg.exe -i INPUT.jpg -an -vcodec libx264 -coder 1 -flags +loop -cmp +chroma -subq 10 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -flags2 +dct8x8 -trellis 2 -partitions +parti8x8+parti4x4 -crf 24 -threads 0 -r 25 -g 25 -y OUTPUT.mp4

10, the common use h264 video stream compression, audio unchanged, to the high-definition streaming service (a new version of FMS live = 1)

ffmpeg -i rtmp://server/live/originalStream -c:a copy -c:v libx264 -vpre slow -f flv “rtmp://server/live/h264Stream live=1″

11. Every 60 seconds, to save a video file, once every minute theme% 3d digital placeholder press exit q

ffmpeg -i rtsp://admin:[email protected]:554/h264/ch1/main/av_stream -r 1/60 -f image2 d:\\1\\images%05d.png -c copy -map 0 -f segment -segment_time 60 -segment_format h264 "d:\\1\\out%03d.h264"
ffmpeg -rtsp_transport tcp -i rtsp://admin:[email protected]:554/h264/ch1/main/av_stream -r 1/60 -f image2 d:\\1\\images%05d.png -c copy -map 0 -f segment -segment_time 60 -segment_format h264 "d:\\1\\out%03d.h264"

12. Save for some MP4 video, press q to quit

ffmpeg  -i "rtsp://admin:[email protected]:554/h264/ch1/main/av_stream" -vcodec libx264 -subq 5 -g 250 -qmin 10 -qmax 51 -i_qfactor 0.71 d:\\1\\out.mp4

13. Save the video stream and simultaneously push rtmp

ffmpeg  -i "rtsp://admin:[email protected]:554/h264/ch1/main/av_stream" -vcodec libx264 -subq 5 -g 250 -qmin 10 -qmax 51 -i_qfactor 0.71 d:\\1\\out1.mp4 -c copy -f flv "rtmp://192.168.1.10:1935/myapp/19"

14. save a video every 60 seconds

ffmpeg  -i "rtsp://admin:[email protected]:554/h264/ch1/main/av_stream" -vcodec libx264 -subq 5 -g 250 -qmin 10 -qmax 51 -i_qfactor 0.71  -map 0 -f segment -segment_time 60 d:\\1\\out%03d.mp4

15. Every 60 seconds kept for a MP4 video file name is the video section start time

ffmpeg  -i "rtsp://admin:[email protected]:554/h264/ch1/main/av_stream" -vcodec libx264 -subq 5 -g 250 -qmin 10 -qmax 51 -i_qfactor 0.71  -map 0 -f segment -segment_time 60 -reset_timestamps 1 -strftime 1 d:\\1\\%Y%m%d%H%M%S.mp4
ffmpeg -y -stimeout 300000000 -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/h264/ch1/main/av_stream" -vcodec copy -acodec copy -map 0 -f segment -segment_time 60 -reset_timestamps 1 -strftime 1  d:\\1\\%Y%m%d%H%M%S.flv

16.ffmpeg Screenshot

/home/seemmo/seemmo/mss/bin/ffmpeg -y -i "rtsp://admin:[email protected]:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1" -ss 00:00:01 -vframes 1 -f image2 -vcodec png /home/seemmo/image.png
/home/seemmo/seemmo/mss/bin/ffmpeg -y -i "rtsp://admin:[email protected]:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1" -ss 00:00:01 -vframes 1 -f image2  /home/seemmo/image.jpg

17.ffmpeg interval Screenshot

ffmpeg -i [视频路径] -r 1 -q:v 2 -f image2 image-%d.jpeg
ffmpeg -i D:\\StreamMeida\\wantong.mp4 -r 25 -q:v 2 -f image2  D:\\StreamMedia\\Snap\\image-%d.jpeg

-r: extracting frames per second, as described above is 1 frame per second, i.e., an image

-q: v: picture quality

-f: picture format, as described above image2

image-% d.jpeg: generating an image file name, full path optional,% d makes file name by an integer number, generates an image as described above is image-1.jpeg, image-2.jpeg, ...

There are other parameters:

-t: duration, such as -t 4 indicates the duration 4s

-ss: start time, such as -ss 01:30:14, 01:30:14 from start

-vframes: Specifies the number of frames extracted, such as -vframes 120, 120 designated extraction

-s: the size format, such as -s 640x360

-y: cover, directly

18. The video track fluidized added rtphint

ffmpeg.exe -i d:\video2.mp4 -vcodec copy -f mp4 -movflags rtphint d:\StreamMedia\EasyDarwin\Movies\video2.mp4
Published 15 original articles · won praise 0 · Views 290

Guess you like

Origin blog.csdn.net/weixin_44478009/article/details/103868075