Open Asinin3 opened 5 years ago
Probably a duplicate of #8.
mpv does not support copy
codecs, and as so, copying without encoding can't be done (well, unless you want to use the ffmpeg branch).
I'm sure the userbase of MPV already knows about and many if not most also already have ffmpeg, I myself have the ffmpeg binary in the same location as MPV, is there a way your script can just use MPV to set things up (crop, start - stop time and so on) and then just turn all that over to ffmpeg to get the "copy" file?
Avidemux does copy and is extremely fast (and no artifacts if you cut at keyframes) but being able to do all that in MPV would save so much time (for example, "copying" something out of a 2 hour stream using ytdl and mpv is a lot faster than first downloading the entire 2hr video just to open it in Avidemux to cut 1 minute clip out of).
is there a way your script can just use MPV to set things up (crop, start - stop time and so on) and then just turn all that over to ffmpeg to get the "copy" file?
If you don't care about cutting streaming video then use lossless-cut. Even if you do care about cutting streaming video I would advise you to open an issue on their repo, as your issue doesn't really have an elegant solution on the mpv
side AFAIK.
This is because the ydl://
"files" are streamed using a hook written in Lua. They can't be passed on to ffmpeg in an encoded format. We can only get them in decoded format. A possible solution is to use youtube-dl -g
as an input to ffmpeg, but that will redownload all the way to part you want to cut, which again makes it not much better than using lossless-cut
.
I realize there's other software to do this. The reason for suggesting it here in a MPV plugin is that its more convenient, quite often I'll be watching something then see a funny scene and just want to make a quick clip out of it. Much faster to do that within MPV which was already open, and already at the timeframe i need to cut around.
If you're not going to implement it then that's okay just close the ticket :/
If you don't care about cutting streaming video then use lossless-cut.
Well, using that is the same as using Avidemux, and defeats the purpose (and practical convenience) of trimming a clip in MPV without re-compressing
This is because the
ydl://
"files" are streamed using a hook written in Lua. They can't be passed on to ffmpeg in an encoded format. We can only get them in decoded format. A possible solution is to useyoutube-dl -g
as an input to ffmpeg, but that will redownload all the way to part you want to cut, which again makes it not much better than usinglossless-cut
.
When you download something with yt-dl and quit the download after a couple of second, even the .part file can be opened and read as proper video.
There's also: https://mpv.io/manual/master/#options-stream-record
Write received/read data from the demuxer to the given output file. The output file will always be overwritten without asking. The output format is determined by the extension of the output file.
And: https://mpv.io/manual/master/#command-interface-dump-cache https://mpv.io/manual/master/#demuxer
Since MPV using yt-dl is downloading the file regardless, the only thing is that it gets rid of it afterwards, which you can prevent. All of this can of course just be an option for the user to enable in the config file for the script, and doesn't have to be forced on everyone by default.
Maybe something like this is also interesting:
https://desuarchive.org/g/thread/80465497/#80506211
or:
When trying to quickly make a clip of something that doesn't have to be cut frame-perfect. It's often better to just cut to the key-frames and save the video without encoding it, obviously this won't work with every codec. But it would be really nice if I could use this script as a quick way to do this instead of opening ffmpeg and putting in the command. It would probably need an option to copy subtitles over as well, since this method obviously won't let you burn them in.