mpv
mpv copied to clipboard
How to get current playing file's directory? And/or change mpv's working directory to it?
What command could I run to get the current playing folder? I thought ${playlist-path} would be the answer, but it returns no value if I load a individual file (and leave the rest for autoload.lua). I need it to call ffmpeg commands from within mpv, as I'd like to set the output directory as the same one of the source file, and mainly because I'd like to run a Windows 10 CMDcd command before ffmpeg so that I could make the following command to work, as the ${path} value doesn't work on the subtitles filter, because FFmpeg needs the path slashes and : to be escaped specifically on the filters section (D\:\\OneDrive\\Videos\\New folder\\input.mkv). Btw, the command is for burning subtitles into video:
Ctrl+ENTER run cmd /c cd /d "D:/OneDrive/Videos/New folder" && ffmpeg -ss ${=ab-loop-a} -to ${=ab-loop-b} -copyts -i "${filename}" -ss ${ab-loop-a} -filter_complex "subtitles='${filename}':si=${=sid}" -c:v libx264 -crf 18 -c:a aac -b:a 512k "D:/OneDrive/Videos/New folder/${filename/no-ext}_output.mp4"
- Also, is there any way to subtract
1from${=sid}? FFmpeg starts the track ID count at 0. - Isn't there a way to change mpv's working directory to the one of the current playing file? This way I wouldn't need the
cdstep. - Plus: Would it be possible to send to the command line two custom values
start_time/end_timethat I'd set using the values of the choosen points'${=playback-time}? Because the ab-loop behavior difficults the process of selecting the ideal cut frame.
This sounds a lot like an XY problem. Why do you need to run ffmpeg from with mpv?
It seems far simpler to have a lua script dump the chosen break points to a file and then use that information to run ffmpeg separately.
This sounds a lot like an XY problem. Why do you need to run ffmpeg from with mpv?
It seems far simpler to have a lua script dump the chosen break points to a file and then use that information to run ffmpeg separately.
Problem is just that I don't have programming experience to write one myself, so I was trying a easier approach. But I already use a lua script for this, cut-video.lua, which I originally got from here and made some minor changes. But there are still a few features missing that I don't know how to implement:
- Make the cut points permanent, so that they stay after running the
cut-finishcommand, and only clear them with a key (possible with ab-loop) - Seek between start and end of selection with keybinds, and also implement a
toggle-loopfunction (except the toggle part, everything else is also possible with ab-loop) - Include milliseconds in the output filename, and show milliseconds of cut points within mpv; it currently shows
HH:MM:ssonly. - I was also not able to make the aforementioned
subtitlescommand to work (fn_cut_finish_subs).
It's