原创内容,转载请注明出处:https://www.myzhenai.com.cn/post/3077.html
关键字:ffmpeg 屏幕录制
在linux下可以录制屏幕的软件不多,但是在Linux下还有一个ffmpeg,这个是一个很强大的视频、音频操作软件包和编解码器包,在Linux下我们只需要一行命令就可以录制出超清的屏幕视频,像我现在演示的这个就是录制成1920×1080像素的视频。相关内容可以看我博客里的更多。我写了很多关于ffmpeg的教程,可以在我博客搜索ffmpeg。
使用方法:使用方法很简单,只要写好命令,在终端下执行这命令就可以,要结束的话,按下键盘上的Ctrl+C键就可以了。
ffmpeg -f alsa -i pulse -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec aac -ac 1 -ar 44100 -qscale 0.01 -vcodec libx264 -preset ultrafast -crf 0 output.mp4 #-f alsa 指定录取声音的驱动 #-i pulse #-f x11grab 指定录取的视频驱动,这里指屏幕 #-s 1920x1080 指定录制的像素 #-acodec aac 指定音频编码 #-vcodec libx264 指定视频编码
[RucLinux@localhost ~]$ ffmpeg -h ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 4.8.2 (GCC) configuration: --enable-ladspa --enable-libass --enable-libbs2b --enable-libcaca --enable-libdc1394 --enable-libfontconfig --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxavs --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libx264 --enable-libx265 --enable-gpl --enable-shared --enable-pthreads --enable-yasm --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Getting help: -h -- print basic options -h long -- print more options -h full -- print all options (including all format and codec specific options, very long) -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter See man ffmpeg for detailed description of the options. Print help / information / capabilities: -L show license -h topic show help -? topic show help -help topic show help --help topic show help -version show version -buildconf show build configuration -formats show available formats -muxers show available muxers -demuxers show available demuxers -devices show available devices -codecs show available codecs -decoders show available decoders -encoders show available encoders -bsfs show available bit stream filters -protocols show available protocols -filters show available filters -pix_fmts show available pixel formats -layouts show standard channel layouts -sample_fmts show available audio sample formats -colors show available color names -sources device list sources of the input device -sinks device list sinks of the output device -hwaccels show available HW acceleration methods Global options (affect whole program instead of just one file: -loglevel loglevel set logging level -v loglevel set logging level -report generate a report -max_alloc bytes set maximum size of a single allocated block -y overwrite output files -n never overwrite output files -ignore_unknown Ignore unknown stream types -filter_threads number of non-complex filter threads -filter_complex_threads number of threads for -filter_complex -stats print progress report during encoding -max_error_rate ratio of errors (0.0: no errors, 1.0: 100% error maximum error rate -bits_per_raw_sample number set the number of bits per raw sample -vol volume change audio volume (256=normal) Per-file main options: -f fmt force format -c codec codec name -codec codec codec name -pre preset preset name -map_metadata outfile[,metadata]:infile[,metadata] set metadata information of outfile from infile -t duration record or transcode "duration" seconds of audio/video -to time_stop record or transcode stop time -fs limit_size set the limit file size in bytes -ss time_off set the start time offset -sseof time_off set the start time offset relative to EOF -seek_timestamp enable/disable seeking by timestamp with -ss -timestamp time set the recording timestamp ('now' to set the current time) -metadata string=string add metadata -program title=string:st=number... add program with specified streams -target type specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-") -apad audio pad -frames number set the number of frames to output -filter filter_graph set stream filtergraph -filter_script filename read stream filtergraph description from a file -reinit_filter reinit filtergraph on input parameter changes -discard discard -disposition disposition Video options: -vframes number set the number of video frames to output -r rate set frame rate (Hz value, fraction or abbreviation) -s size set frame size (WxH or abbreviation) -aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777) -bits_per_raw_sample number set the number of bits per raw sample -vn disable video -vcodec codec force video codec ('copy' to copy stream) -timecode hh:mm:ss[:;.]ff set initial TimeCode value. -pass n select the pass number (1 to 3) -vf filter_graph set video filters -ab bitrate audio bitrate (please use -b:a) -b bitrate video bitrate (please use -b:v) -dn disable data Audio options: -aframes number set the number of audio frames to output -aq quality set audio quality (codec-specific) -ar rate set audio sampling rate (in Hz) -ac channels set number of audio channels -an disable audio -acodec codec force audio codec ('copy' to copy stream) -vol volume change audio volume (256=normal) -af filter_graph set audio filters Subtitle options: -s size set frame size (WxH or abbreviation) -sn disable subtitle -scodec codec force subtitle codec ('copy' to copy stream) -stag fourcc/tag force subtitle tag/fourcc -fix_sub_duration fix subtitles duration -canvas_size size set canvas size (WxH or abbreviation) -spre preset set the subtitle options to the indicated preset [RucLinux@localhost ~]$
sicnature ---------------------------------------------------------------------
I P 地 址: 18.118.31.0
区 域 位 置: 美国马萨诸塞
系 统 信 息:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普 | 海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source http://myzhenai.com/post/3077.html
1 评论
Windows下录制屏幕的命令
D:\ffmpeg\bin\ffmpeg.exe -f dshow -i video=”screen-capture-recorder” -f dshow -i audio=”virtual-audio-capturer” -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
要先安装一个Setup Screen Capturer Recorder
下载地址:https://sourceforge.net/projects/screencapturer/