I tried both your suggestions and get these errors. The ffmpeg
$ env AUDIODEV=/dev/audio1 mpg123 music.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.27.2; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
[src/libmpg123/readers.c:INT123_open_stream():1204] error: Cannot open file music.mp3: No such file or directory
main: [src/mpg123.c:open_track():775] error: Cannot open music.mp3: File access error. (code 22)
$ mpg123 -a /dev/audio1 music.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.27.2; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Terminal control enabled, press 'h' for listing of keys and functions.
Playing MPEG stream 1 of 1: music.mp3 ...
MPEG 1.0 L III vbr 44100 j-s
[src/libout123/libout123.c:out123_play():739] error: Error in writing audio, wrote only -1 of 4608 (Input/output error?)!
main: [src/mpg123.c:play_frame():876] error: Deep trouble! Cannot flush to my output anymore!
And from ffmpeg I get this:
...
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, s16le, from '/dev/pad0':
Duration: N/A, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, oss, from '/dev/audio':
Duration: N/A, start: 1623034291.434141, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
At least one output file must be specified
$
Although, @rvp the script only runs if I comment out the line containing -filter_complex '[0] [1] amix'
because otherwise I get:
$ sh screenrecord.sh
screenrecord.sh: 1: parameter not set
I also tried with env AUDIODEV=/dev/audio1 mpv --no-video music.mp3
and it looked as though the track was playing but I heard no sound.
$ env AUDIODEV=/dev/audio1 mpv --no-video music.mp3
(+) Audio --aid=1 (mp3 2ch 44100Hz)
AO: [sdl] 44100Hz stereo 2ch s32
audio: Input/output error%)
A: 00:00:04 / 00:03:55 (2%)
Exiting... (Quit)
$
😕
I'm fully aware this is probably due to my lack of understanding of the script itself, but I tried a bunch of different things before posting this comment and my brain capacity is maxed out 😆