Closed jgreco closed 5 years ago
Indeed, there's nothing wrong with the logs, as far as I can see. Can you try running:
mpv -v https://www.youtube.com/watch?v=c82Bg7Y90No --start=0:00:00.625 --end=0:00:01.292 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=1 --sid=no --sub-ass-override=yes --sub-auto=exact --video-rotate=0 --vf-add=lavfi-colormatrix=bt709:bt601 --vf-add=lavfi-crop=1280:720:0:0 --ovcopts-add=threads=2 --ovcopts-add=b=47940k --ovcopts-add=crf=10 --log-file=encodelog.txt -o=/Users/john/Desktop/webms/watchv=c82Bg7Y90No-[00.00.625-00.01.292]-audio.webm
in a terminal and posting the resulting log file here?
edit: changed --log to --log-file.
mpv -v https://www.youtube.com/watch?v=c82Bg7Y90No --start=0:00:00.625 --end=0:00:01.292 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=1 --sid=no --sub-ass-override=yes --sub-auto=exact --video-rotate=0 --vf-add=lavfi-colormatrix=bt709:bt601 --vf-add=lavfi-crop=1280:720:0:0 --ovcopts-add=threads=2 --ovcopts-add=b=47940k --ovcopts-add=crf=10 --log-file=encodelog.txt -o=/Users/john/Desktop/testout.webm
https://gist.githubusercontent.com/jgreco/02c76e36f887f919e27a123cdaf44280/
It looks like when mpv is encoding, it passes the default --format bestvideo+bestaudio/best
to youtube-dl.
When it's not encoding:
mpv -v https://www.youtube.com/watch\?v\=c82Bg7Y90No -log-file=playlog.txt
https://gist.github.com/jgreco/1dd153a6acd382cd8f23759b2ae7ce97
Then mpv invokes youtube-dl with --format bestvideo[height<=?720]+bestaudio/best
, (my ytdl-format config)
So I guess this is an mpv bug.
That said, if I pass --ytdl-format to mpv explicitly when encoding,
mpv -v https://www.youtube.com/watch\?v\=c82Bg7Y90No --ytdl-format='bestvideo[height<=?720]+bestaudio/best' --start=0:00:00.625 --end=0:00:01.292 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=1 --sid=no --sub-ass-override=yes --sub-auto=exact --video-rotate=0 --vf-add=lavfi-colormatrix=bt709:bt601 --vf-add=lavfi-crop=1280:720:0:0 --ovcopts-add=threads=2 --ovcopts-add=b=47940k --ovcopts-add=crf=10 --log-file=encode3log.txt -o=/Users/john/Desktop/testout.webm
then the encode works properly. It seems like it's ignoring my mpv.conf when encoding but still respects --ytdl-format from the command line. I think this could be the basis of a work-around until(?) it's fixed in mpv.
Seems to work fine adding a ytdl-format line
local command = {
"mpv",
path,
"--start=" .. seconds_to_time_string(startTime, false, true),
"--end=" .. seconds_to_time_string(endTime, false, true),
"--ovc=" .. tostring(format.videoCodec),
"--oac=" .. tostring(format.audioCodec),
"--ytdl-format=" .. mp.get_property("ytdl-format"),
"--loop-file=no"
}
mpv version
Description
with
ytdl-format=bestvideo[height<=?720]+bestaudio/best
set in my mpv.conf, mpv will select the best <=720p video to play from youtube. However the encoding mpv process seems to get the highest resolution version youtube has. If the highest resolution version is greater than 720p, the result is the encode takes far longer than it should, takes more bandwidth than it should, and is cropped incorrectly (getting only the upper-left corner of the video.)For instance this youtube video has a 2160p version available. When I play it with my mpv config, youtube-dl gets the 720p version of it:
If I encode a second of video at the same point with mpv-webm, the resulting webm looks like this:
The resulting webm is 720p... but it's only a 720p crop of the top left of the 2160p version.
(This all used to work properly, I think maybe it changed with 0.28.2)
Logs
They don't seem to tell me much, but for what they're worth: https://gist.github.com/jgreco/64d194443fc2670dabb7ff45dddcb365