Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Audio recording (using ossaudio)
Dear Tetsuya,
On 2020-03-19, Tetsuya Isaki wrote:
> 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?
If I used it correctly, it is for "-f oss" so for the input. Maybe it
should go before "-i", but if I recall correctly it does not make
a difference.
I think "-ac" is for the output format (ffmpeg performs appropriate
conversion).
> % /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.
I did not figure out why the file is too short, but there is some
oss/ffmpeg interaction (maybe due to non-blocking reads?) which causes
this.
I created wip/ffmpeg4-nbsdaudio and nia improved it, and now recording
works fine:
ffmpeg4 -f nbsdaudio -i /dev/audio /tmp/netbsd.wav
records as expected.
> Thanks,
> ---
> Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>
Thank you!
--
Kind regards,
Yorick Hardy
Home |
Main Index |
Thread Index |
Old Index