FFmpeg command: from beginner to proficient | ffmpeg command video recording
- FFmpeg command: from beginner to proficient | ffmpeg command video recording
FFmpeg command: from beginner to proficient | ffmpeg command video recording
This section mainly introduces the method of audio and video recording using ffmpeg command, and lists some examples.
Installation software: Screen Capturer Recorder
Project address: on screen capture recorder to video free Files
Install the latest version:
install software:
View available device names
After completing the installation, we can enter the following command on the command line to view the available device names of the computer:
ffmpeg -list_devices true -f dshow -i dummy
Output the following results:
[dshow @ 000001e3fded3800] "Integrated Camera" (video)
[dshow @ 000001e3fded3800] Alternative name "@device_pnp_\\?\usb#vid_13d3&pid_56a6&mi_00#6&1c1093a4&1&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001e3fded3800] "screen-capture-recorder" (video)
[dshow @ 000001e3fded3800] Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{4EA69364-2C8A-4AE6-A561-56E4B5044439}"
[dshow @ 000001e3fded3800] "OBS Virtual Camera" (video)
[dshow @ 000001e3fded3800] Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{A3FCE0F5-3493-419F-958A-ABA1250EC20B}"
[dshow @ 000001e3fded3800] "麦克风 (Realtek(R) Audio)" (audio)
[dshow @ 000001e3fded3800] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{E35D34C8-3763-4470-BDFF-5999B6DB4347}"
[dshow @ 000001e3fded3800] "virtual-audio-capturer" (audio)
[dshow @ 000001e3fded3800] Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E146464-DB61-4309-AFA1-3578E927E935}"
[dshow @ 000001e3fded3800] "立体声混音 (Realtek(R) Audio)" (audio)
[dshow @ 000001e3fded3800] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{159589C7-204D-4C6C-8804-B576E8B7DC6C}"
dummy: Immediate exit requested
in:
- “Integrated Camera”: laptop camera
- "screen-capture-recorder": device for recording the desktop
- "Microphone (Realtek® Audio)": Microphone
- "virtual-audio-capturer": device for recording system sound
Audio and video recording
Record video (default parameters)
desktop:
ffmpeg -f dshow -i video="screen-capture-recorder" v-out.mp4
Camera:
ffmpeg -f dshow -i video="Integrated Camera" -y v-out2.flv
Note: It depends on your own camera name.
Record sound (default parameters)
System sound:
ffmpeg -f dshow -i audio="virtual-audio-capturer" a-out.aac
Note: Ctrl + C exits recording.
System + microphone sound:
ffmpeg -f dshow -i audio="麦克风 (Realtek(R) Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 a-out2.aac
Note: It depends on your own microphone name.
Record system + microphone sound and video simultaneously (default parameters)
ffmpeg -f dshow -i audio="麦克风 (Realtek(R) Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -f dshow -i video="screen-capture-recorder" -y av-out.flv
View optional parameters for video recording
View screen-capture-recorder related parameters:
ffmpeg -f dshow -list_options true -i video="screen-capture-recorder"
Output:
[dshow @ 0000023f4f3a3740] DirectShow video device options (from video devices)
[dshow @ 0000023f4f3a3740] Pin "Capture" (alternative pin name "1")
[dshow @ 0000023f4f3a3740] pixel_format=bgr0 min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=bgr0 min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=bgr24 min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=rgb555le min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=rgb555le min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=rgb8 min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] pixel_format=yuv420p min s=1x1 fps=0.02 max s=1920x1080 fps=30
[dshow @ 0000023f4f3a3740] Could not find output pin from video capture device.
video=screen-capture-recorder: I/O error
View optional parameters for audio recording
View virtual-audio-capturer related parameters:
ffmpeg -f dshow -list_options true -i audio="virtual-audio-capturer"
Output:
[dshow @ 0000024b7e113740] DirectShow audio only device options (from audio devices)
[dshow @ 0000024b7e113740] Pin "Capture Virtual Audio Pin" (alternative pin name "1")
[dshow @ 0000024b7e113740] ch= 2, bits=16, rate= 48000
audio=virtual-audio-capturer: Immediate exit requested
View microphone (Realtek(R) Audio) related parameters:
ffmpeg -f dshow -list_options true -i audio="麦克风 (Realtek(R) Audio)"
Output:
[dshow @ 00000260768b3700] DirectShow audio only device options (from audio devices)
[dshow @ 00000260768b3700] Pin "Capture" (alternative pin name "Capture")
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 44100
Last message repeated 1 times
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 44100
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 32000
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 32000
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 22050
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 22050
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 11025
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 11025
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 8000
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 8000
[dshow @ 00000260768b3700] ch= 2, bits= 8, rate= 44100
[dshow @ 00000260768b3700] ch= 1, bits= 8, rate= 44100
[dshow @ 00000260768b3700] ch= 2, bits= 8, rate= 22050
[dshow @ 00000260768b3700] ch= 1, bits= 8, rate= 22050
[dshow @ 00000260768b3700] ch= 2, bits= 8, rate= 11025
[dshow @ 00000260768b3700] ch= 1, bits= 8, rate= 11025
[dshow @ 00000260768b3700] ch= 2, bits= 8, rate= 8000
[dshow @ 00000260768b3700] ch= 1, bits= 8, rate= 8000
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 48000
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 48000
[dshow @ 00000260768b3700] ch= 2, bits=16, rate= 96000
[dshow @ 00000260768b3700] ch= 1, bits=16, rate= 96000
audio=麦克风 (Realtek(R) Audio): Immediate exit requested
Record audio and video with specified parameters
ffmpeg -f dshow -i audio="麦克风 (Realtek(R) Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -f dshow -video_size 1920x1080 -framerate 15 -pixel_format yuv420p -i video="screen-capture-recorder" -vcodec h264_qsv -b:v 3M -y av-out.flv
ffmpeg -f dshow -i audio="麦克风 (Realtek(R) Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -f dshow -i video="screen-capture-recorder" -vcodec h264_qsv -b:v 3M -r 15 -y av-out2.mp4
ffmpeg -f dshow -i audio="麦克风 (Realtek(R) Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -f dshow -framerate 15 -pixel_format yuv420p -i video="screen-capture-recorder" -vcodec h264_qsv -b:v 3M -r 15 -y av-out3.mp4
parameter:
- -video_size: video size
- -vcodec: video encoding format
- -framerate: video frame rate
- -pixel_format: video pixel format
- -b:v: video bit rate
- -r: frame rate