Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Audio recording (using ossaudio)

At Tue, 10 Mar 2020 20:49:55 +0200,
Yorick Hardy wrote:
>  ffmpeg4 -f oss -i /dev/audio -channels 1 -sample_rate 48000 /tmp/test.wav
> is completely garbled and too short. The file also seems to be 2-channel,
> so I think the recording settings are somehow not applied correctly.

I rarely use ffmpeg4 but according to ffmpeg4 documents,
-channels/-sample_rate are for video and -ac/-ar are for audio?

 % /usr/bin/time ffmpeg4 -f oss -t 0:05 -i /dev/audio -channels 1 test1.wav
         5.04 real         0.02 user         0.04 sys
 % file test1.wav
 test1.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 48000 Hz

 % /usr/bin/time ffmpeg4 -f oss -t 0:05 -i /dev/audio -ac 1 test2.wav
         5.04 real         0.04 user         0.02 sys
 % file test2.wav
 test2.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 48000 Hz

 % /usr/bin/time audioplay test1.wav
         2.54 real         0.00 user         0.00 sys
 % /usr/bin/time audioplay test2.wav
         2.54 real         0.00 user         0.00 sys

As you said, output file was too short.  However ffmpeg4 probably
recorded specified period and created small file so that I think
you need to look ffmpeg4 at first.

Tetsuya Isaki < />

Home | Main Index | Thread Index | Old Index