ffmpeg

ffmpeg -hwaccels 查看可用的硬件加速。
作者:dogcraft
https://www.bilibili.com/read/cv4834608/
出处: bilibili

root@proxtest:~# ps aux | grep ffmpeg
root 6788 0.1 0.2 598268 39204 ? Ssl 15:36 0:00 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang24/cmd.txt
root 6796 66.9 0.8 1090884 137988 ? SLsl 15:36 1:47 /usr/bin/ffmpeg -loglevel warning -r 10 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.24:8557/h264 -an -strict -2 -threads 1 -preset ultrafast -vcodec libvpx -r 10 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 1800 /home/Shinobi/videos/CXLgPr6Htz/zhonghang24/%Y-%m-%dT%H-%M-%S.webm -an -c:v mjpeg -f mpjpeg -boundary_tag shinobi -strict -2 -r 20 -q:v 10 pipe:1 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang24/s.jpg -y
root 7038 0.5 0.2 596220 39308 ? Ssl 15:38 0:00 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang27/cmd.txt
root 7046 88.8 0.8 1094344 139556 ? SLsl 15:38 0:39 /usr/bin/ffmpeg -loglevel warning -r 20 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.27:8557/h264 -an -strict -2 -threads 1 -vcodec libvpx -r 20 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 3600 /home/Shinobi/videos/CXLgPr6Htz/zhonghang27/%Y-%m-%dT%H-%M-%S.webm -an -c:v mjpeg -f mpjpeg -boundary_tag shinobi -strict -2 -r 2 -q:v 15 -vf drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:text='%{localtime}':x=(w-tw)/2:y=0:fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=10 pipe:1 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang27/s.jpg -y
root 7190 0.0 0.0 12784 956 pts/1 S+ 15:39 0:00 grep ffmpeg
root 31988 0.0 0.2 596788 39932 ? Ssl 14:45 0:01 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang26/cmd.txt
root 31996 53.0 0.5 819328 96352 ? SLsl 14:45 28:30 /usr/bin/ffmpeg -loglevel warning -r 10 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.26:8557/h264 -an -segment_format_options movflags=faststart+frag_keyframe+empty_moov -strict -2 -threads 1 -preset ultrafast -vcodec copy -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 600 /home/Shinobi/videos/CXLgPr6Htz/zhonghang26/%Y-%m-%dT%H-%M-%S.mp4 -an -f hls -strict -2 -r 10 -crf 15 -tune zerolatency -g 1 -hls_time 2 -hls_list_size 3 -start_number 0 -hls_allow_cache 0 -hls_flags +delete_segments+omit_endlist /dev/shm/streams/CXLgPr6Htz/zhonghang26/s.m3u8 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang26/s.jpg -y

root@proxtest:~# ps aux | grep ffmpeg
root 7200 0.3 0.2 596064 39212 ? Ssl 15:39 0:00 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang24/cmd.txt
root 7208 106 0.8 1090272 136452 ? RLsl 15:39 1:00 /usr/bin/ffmpeg -loglevel warning -r 10 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.24:8557/h264 -an -strict -2 -threads 1 -preset ultrafast -vcodec libvpx -r 10 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 1800 /home/Shinobi/videos/CXLgPr6Htz/zhonghang24/%Y-%m-%dT%H-%M-%S.webm -an -c:v mjpeg -f mpjpeg -boundary_tag shinobi -strict -2 -r 20 -q:v 10 pipe:1 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang24/s.jpg -y
root 7347 9.0 0.2 563300 44172 ? Ssl 15:40 0:00 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang27/cmd.txt
root 7355 12.0 0.5 674384 84168 ? RLsl 15:40 0:00 /usr/bin/ffmpeg -loglevel warning -r 20 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.27:8557/h264 -an -strict -2 -threads 1 -vcodec libvpx -r 20 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 3600 /home/Shinobi/videos/CXLgPr6Htz/zhonghang27/%Y-%m-%dT%H-%M-%S.webm -an -c:v mjpeg -f mpjpeg -boundary_tag shinobi -strict -2 -r 2 -q:v 15 -vf drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:text='%{localtime}':x=(w-tw)/2:y=0:fontcolor=white:box=1:boxcolor=0x00000000@1:fontsize=10 pipe:1 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang27/s.jpg -y
root 7383 0.0 0.0 12784 940 pts/1 S+ 15:40 0:00 grep ffmpeg
root 31988 0.0 0.2 596788 39932 ? Ssl 14:45 0:01 node ./libs/cameraThread/singleCamera.js /usr/bin/ffmpeg /dev/shm/streams/CXLgPr6Htz/zhonghang26/cmd.txt
root 31996 52.9 0.5 819328 96352 ? SLsl 14:45 29:00 /usr/bin/ffmpeg -loglevel warning -r 10 -progress pipe:5 -use_wallclock_as_timestamps 1 -analyzeduration 1000000 -probesize 1000000 -fflags +igndts -rtsp_transport tcp -hwaccel auto -i rtsp://admin:admin12345@10.1.30.26:8557/h264 -an -segment_format_options movflags=faststart+frag_keyframe+empty_moov -strict -2 -threads 1 -preset ultrafast -vcodec copy -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:8 -segment_time 600 /home/Shinobi/videos/CXLgPr6Htz/zhonghang26/%Y-%m-%dT%H-%M-%S.mp4 -an -f hls -strict -2 -r 10 -crf 15 -tune zerolatency -g 1 -hls_time 2 -hls_list_size 3 -start_number 0 -hls_allow_cache 0 -hls_flags +delete_segments+omit_endlist /dev/shm/streams/CXLgPr6Htz/zhonghang26/s.m3u8 -vf fps=1 -update 1 /dev/shm/streams/CXLgPr6Htz/zhonghang26/s.jpg -y

strftime 应该是时间水印相关设置

-vf 视频过滤器
-strict strictness 跟标准的严格性
-vcodec codec 强制使用codec编解码方式。如果用copy表示原始编解码数据必须被拷贝
-b bitrate 设置比特率,缺省200kb/s
-r fps 设置帧频 缺省25
-s size 设置帧大小 格式为WXH 缺省160X128.下面的简写也可以直接使用:

于x264的参数众多,各种参数的配合复杂,为了使用者方便,x264建议如无特别需要可使用preset和tune设置。这套开发者推荐的参数较为合理,可在此基础上在调整一些具体参数以符合自己需要,手动设定的参数会覆盖preset和tune里的参数。

--preset的参数主要调节编码速度和质量的平衡,有ultrafast、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo这10个选项,从快到慢。

--tune的参数主要配合视频类型和视觉优化的参数,或特别的情况。如果视频的内容符合其中一个可用的调整值又或者有其中需要,则可以使用此选项,否则建议不使用(如tune grain是为高比特率的编码而设计的)。

tune的值有:
film: 电影、真人类型;
animation: 动画;
grain: 需要保留大量的grain时用;
stillimage: 静态图像编码时使用;
psnr: 为提高psnr做了优化的参数;
ssim: 为提高ssim做了优化的参数;
fastdecode: 可以快速解码的参数;
zerolatency:零延迟,用在需要非常低的延迟的情况下,比如电视电话会议的编码。

you cannot use MP4 as the recording file type if the Recording Video Codec is set to libvpx. libvpx is only for WebM.

User Intervention
Some camera streams do not allow being cut in the middle of a recording. Which leads your last MP4 recording to be unplayable. It is technically still all there it just has not been “closed”. You can record WebM files to minimize this issue if you regularly switch modes.

ffmpeg参考:https://blog.csdn.net/xiaoluer/article/details/81136478
https://www.cnblogs.com/mwl523/p/10856633.html
https://wiki.archlinux.org/index.php/FFmpeg
https://www.cnblogs.com/vczf/p/13446249.html
https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1
https://blog.csdn.net/sinat_14826983/article/details/82597272
https://blog.csdn.net/leixiaohua1020/article/details/12751349

原文地址:https://www.cnblogs.com/weihua2020/p/13907590.html