StreamCopy Alfred Workflow
Takes a valid video URL from the clipboard (mp4, hls, etc.), plays the video using MPV and writes a video file to disk.
-Uses applescriipting to run commands with iTerm2
-Provides popup user interface to select video quality
-Writes to folder ~/Movies
youtube-dl, ffmpeg, mpv, iTerm2 (installed with homebrew)
The workflow creates a pipe between ffmpeg and mpv. Closing the window before the download has finished will result in a broken pipe i.e. when streaming from an hls playlist. This results in ffmpeg not writing the trailer for the mp4 file correctly. The file still plays in apps like IINA or MPV but Quicktime player does not recognize the format. Nor does Quicklook.
Solution 1: re-encode the video file with ffmpeg. Then Quicktime and Quicklook will have no issues playing file
Solution 2: Use ffmpeg built in streaming protocol zmq to stream to server on localhost then play with ffplay. Basic command for this looks somethting like:
ffmpeg -re -i input.m3u8 -c:v libx264 -c:a aac -f tee -map 0:v -map 0:a "output.mp4|[f=mpegts]zmq:tcp://127.0.0.1:5555"
To Do: Incorporate above strategy into project as alternative method.