Running mpg123 with FIFO control?

百般思念 提交于 2019-12-24 06:35:08

问题


I need to run mpg123 with a single file, such that it will autostart and autoclose, like it normally does, however, I need to be able to override this default behavior with commands sent to a fifo file.

I had been running mpg123 filename.mp3 from a script, and simply waiting for it to finish before moving on. However, I'd like another script to be able to pause playback, control volume, or kill the process early, depending on the user's input.

mpg123 -R --fifo /srv/http/newsctl filename.mp3 seems to start mpg123 and create the pipe, but does not start playback.

How do I make this work?


回答1:


Unfortunately mpg123 is unable to play a specified file when -R argument is used. To start the playback you have to load a file using created fifo.

FIFO_MPG='/srv/http/newsctl'
mpg123 -R --fifo "$FIFO_MPG"
echo 'load filename.mp3' >> "$FIFO_MPG"

Also I suggest you to silence verbose output by using

echo 'silence' >> "$FIFO_MPG"

I hope it is not too late. Good luck! ;)



来源:https://stackoverflow.com/questions/17927124/running-mpg123-with-fifo-control

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!