[FFmpeg-user] Play video and simultaneously record audio

Michael Koch astroelectronic at t-online.de
Sat Jan 18 21:21:18 EET 2020


>>
>>
>> My second test:
>> ffmpeg -re -i test.mp4 -f dshow -channels 2 -i audio="Mikrofon 
>> (Realtek High Definiti" -y -map 1:a audio.wav -map 0:v -f sdl2 -
>>
>> This command line has two problems:
>> 1. The video doesn't play continuously, it's stop-and-go. May be my 
>> notebook has not enough computing power? Any ideas how to avoid this 
>> problem?
>> 2. FFmpeg doesn't stop when the end of the video has been reached. 
>> The audio file gets longer than the video. I did already try to add 
>> the -shortest option, but it didn't solve the problem.
>>
>
> 1) Ok, let's pipe it to ffplay then.
>
> 2) The audio and playback video are independent outputs. So, ffmpeg 
> will have to be manually stopped.
>
>     ffmpeg -an -i test.mp4 -f dshow -channels 2 -i audio="Mikrofon 
> (Realtek High Definiti" -y -map 1:a audio.wav -map 0:v -c copy -f 
> mpegts - | ffplay -f mpegts -

I did try the above example (with some changes) but it has another 
problem: FFplay can't be stopped when the video has ended, and it uses 
the full screen. Which means I can't see the console window and can't 
close it. FFmpeg can only be stopped by the task manager.

I found a better solution for the stop-and-go problem with sdl2. Adding 
-audio_buffer_size 100 solves the problem:

ffmpeg -re -i test.mp4 -f dshow -audio_buffer_size 100 -channels 2 -i 
audio="Mikrofon (Realtek High Definiti" -y -map 1:a audio.wav -map 0:v 
-f sdl2 -

Michael



More information about the ffmpeg-user mailing list