(Go: >> BACK << -|- >> HOME <<)

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get current playing file's directory? And/or change mpv's working directory to it? #13441

Open
KonoVitoDa opened this issue Feb 8, 2024 · 2 comments

Comments

@KonoVitoDa
Copy link

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 1 from ${=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 cd step.
  • Plus: Would it be possible to send to the command line two custom values start_time/end_time that 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.
@Traneptora
Copy link
Member
Traneptora commented Feb 8, 2024

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.

@KonoVitoDa
Copy link
Author

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-finish command, 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-loop function (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:ss only.
  • I was also not able to make the aforementioned subtitles command to work (fn_cut_finish_subs).

It's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants