Sample Header Ad - 728x90

How to play the audio of a .mkv file from a command line from a specific offset to another at different speeds

0 votes
0 answers
77 views
The first thing I tried was using VLC: /Applications/VLC.app/Contents/MacOS/VLC '{$movpath}' --start-time='{$ts}' --stop-time='{$te}' --no-video rate='0.5' 2> /dev/null; However, the player takes 10 seconds to load every time the command is executed, and this is too slow for my purpose as I am calling this command with shell_exec() from a PHP command line script. I read: https://apple.stackexchange.com/questions/257869/how-to-play-audio-files-from-command-line , and tried afplay, but it doesn't recognise .mkv files. Ideally I should not need pre-processing eg. should not need to use ffmpeg to extract the audio from the .mkv file first, as I have tried this, and it also takes too long for my purpose. In addition, I do need to adjust the speed of the playback as well, as I need to play the file at various speeds (eg. 1x, 0.5x and 0.25x). How might I achieve my aim?
Asked by forgodsakehold (413 rep)
Nov 24, 2023, 04:13 AM
Last activity: Nov 24, 2023, 08:28 PM