PINE64
How to play audio from ffmpeg? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: General Discussion on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=127)
+--- Thread: How to play audio from ffmpeg? (/showthread.php?tid=18658)

Pages: 1 2


How to play audio from ffmpeg? - Manieck71 - 08-28-2023

Hi

System Mobian.
I run in terminal
ffmpeg -i file.wav -f alsa hw:0
but nothing is heard

How to configure?
How to switch between handset and loudspeaker?


RE: How to play audio from ffmpeg? - Kevin Kofler - 08-28-2023

Use -f pulse, not -f alsa. You want to output through PulseAudio/Pipewire, not directly through ALSA, because the raw ALSA device is normally already opened and reserved by PulseAudio or Pipewire. (Note that Pipewire supports the PulseAudio protocol, so -f pulse will work for both.)


RE: How to play audio from ffmpeg? - Manieck71 - 08-29-2023

(08-28-2023, 05:59 PM)Kevin Kofler Wrote: Use -f pulse, not -f alsa. You want to output through PulseAudio/Pipewire, not directly through ALSA, because the raw ALSA device is normally already opened and reserved by PulseAudio or Pipewire. (Note that Pipewire supports the PulseAudio protocol, so -f pulse will work for both.)

I did as you wrote, but still no sound.


RE: How to play audio from ffmpeg? - Gumur - 08-29-2023

The file is "xxx.way" or "xxx.wav"?


RE: How to play audio from ffmpeg? - Manieck71 - 08-29-2023

(08-29-2023, 08:27 AM)Gumur Wrote: The file is "xxx.way" or "xxx.wav"?
Of course xxx.wav :-) My mistake.

(08-28-2023, 05:59 PM)Kevin Kofler Wrote: Use -f pulse, not -f alsa. You want to output through PulseAudio/Pipewire, not directly through ALSA, because the raw ALSA device is normally already opened and reserved by PulseAudio or Pipewire. (Note that Pipewire supports the PulseAudio protocol, so -f pulse will work for both.)

Unfortunately using pulse still doesn't work.
I installed Kali System and it plays sound on the speaker using alsa and pulse.
How do I switch to built-in headphones?


RE: How to play audio from ffmpeg? - Kevin Kofler - 08-29-2023

What do you mean by "built-in headphones"? The earpiece? Or the headphone port (but then the headphones are not "built-in", only the port is)?

The former can be selected with:
pactl set-sink-port 0 '[Out] Earpiece'
the latter with:
pactl set-sink-port 0 '[Out] Headphones'
and to switch back to the speaker, use:
pactl set-sink-port 0 '[Out] Speaker'


RE: How to play audio from ffmpeg? - Manieck71 - 08-30-2023

(08-29-2023, 07:31 PM)Kevin Kofler Wrote: What do you mean by "built-in headphones"? The earpiece? Or the headphone port (but then the headphones are not "built-in", only the port is)?

The former can be selected with:
pactl set-sink-port 0 '[Out] Earpiece'
the latter with:
pactl set-sink-port 0 '[Out] Headphones'
and to switch back to the speaker, use:
pactl set-sink-port 0 '[Out] Speaker'

Yes, I mean the earpiece.


RE: How to play audio from ffmpeg? - Manieck71 - 08-30-2023

(08-30-2023, 02:18 AM)Manieck71 Wrote:
(08-29-2023, 07:31 PM)Kevin Kofler Wrote: What do you mean by "built-in headphones"? The earpiece? Or the headphone port (but then the headphones are not "built-in", only the port is)?

The former can be selected with:
pactl set-sink-port 0 '[Out] Earpiece'
the latter with:
pactl set-sink-port 0 '[Out] Headphones'
and to switch back to the speaker, use:
pactl set-sink-port 0 '[Out] Speaker'

Yes, I mean the earpiece.
Thank you, it works!


RE: How to play audio from ffmpeg? - Manieck71 - 08-30-2023

It works on Kali and Ubuntu but won't work on Mobian.
I have silence all the time


RE: How to play audio from ffmpeg? - Kevin Kofler - 08-30-2023

Well, open up a volume control GUI (on Plasma Mobile, it is in the settings under "Audio", I don't know where it is on Phosh) and check that the earpiece is not muted and that its volume is not zero. Normally, if you set a reasonable volume once, it should remember it next time you switch to the earpiece. Though I have seen various volume control bugs resetting some volumes to zero for whatever reason, so I cannot promise that it will not end up back at zero at some point in the future.