代码之家  ›  专栏  ›  技术社区  ›  Lukas Kitsche

如何使用systemd播放mp3曲目的前n秒?

  •  -2
  • Lukas Kitsche  · 技术社区  · 7 年前

    [Unit]
    Description=play the a team song
    
    [Service]
    ExecStart=/usr/bin/mpg123 /home/pi/Music/the_a_team.mp3
    RuntimeMaxSec=10
    

    歌曲播放21秒,然后停止。我不明白。 我也没有找到另一种解决方法,比如告诉mpg123只玩前n秒。请帮帮我。任何解决方案都可以。

    1 回复  |  直到 7 年前
        1
  •  0
  •   oxagast    7 年前

    试试这个:

    [Unit]
    Description=play the a team song
    
    [Service]
    ExecStart=/usr/bin/ffplay /home/pi/Music/the_a_team.mp3 -t 10 -autoexit -nodisp
    

    请注意,ffplay是ffmpeg包的一部分。

    推荐文章