Closed ghost closed 4 years ago
I just updated the webm converter script and MPV just to be sure, and the problem persists.
I can't reproduce it, at least not with this video (used youtube-dl to download it).
Could you run the encoding command:
.\mpv.com "I:\! TV\Trailer Park Boys\Season 06\Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv" --output=log-encode.txt --start=0:01:09.903 --end=0:01:20.714 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=no --sid=no --sub-ass-override=yes --sub-auto=exact --sub-delay=0.000000 --video-rotate=0 --ovcopts-add=threads=12 "--oset-metadata=title=%60%Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3" --ovcopts-add=b=2212k --ovcopts-add=crf=10 --ovcopts-add=flags=+pass2 "-o=I:\Pictures\WebM/Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv-[01.09.903-01.20.714].webm"
in a cmd/PowerShell window and send me the "log-encode.txt", and the cmd window output?
I can't reproduce it, at least not with this video (used youtube-dl to download it).
Could you run the encoding command:
.\mpv.com "I:\! TV\Trailer Park Boys\Season 06\Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv" --output=log-encode.txt --start=0:01:09.903 --end=0:01:20.714 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=no --sid=no --sub-ass-override=yes --sub-auto=exact --sub-delay=0.000000 --video-rotate=0 --ovcopts-add=threads=12 "--oset-metadata=title=%60%Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3" --ovcopts-add=b=2212k --ovcopts-add=crf=10 --ovcopts-add=flags=+pass2 "-o=I:\Pictures\WebM/Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv-[01.09.903-01.20.714].webm"
in a cmd/PowerShell window and send me the "log-encode.txt", and the cmd window output?
C:\Program Files\MPV>.\mpv.com "I:\! TV\Trailer Park Boys\Season 06\Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv" --output=log-encode.txt --start=0:01:09.903 --end=0:01:20.714 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=no --sid=no --sub-ass-override=yes --sub-auto=exact --sub-delay=0.000000 --video-rotate=0 --ovcopts-add=threads=12 "--oset-metadata=title=%60%Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3" --ovcopts-add=b=2212k --ovcopts-add=crf=10 --ovcopts-add=flags=+pass2 "-o=I:\Pictures\WebM\1.webm"
Error parsing option output (option not found)
Setting commandline option --output=log-encode.txt failed.
Exiting... (Fatal error)
changing --output to log-file gives:
C:\Program Files\MPV>.\mpv.com "I:\! TV\Trailer Park Boys\Season 06\Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv" --log-file=log-encode.txt --start=0:01:09.903 --end=0:01:20.714 --ovc=libvpx --oac=libvorbis --loop-file=no --vid=1 --aid=no --sid=no --sub-ass-override=yes --sub-auto=exact --sub-delay=0.000000 --video-rotate=0 --ovcopts-add=threads=12 "--oset-metadata=title=%60%Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3" --ovcopts-add=b=2212k --ovcopts-add=crf=10 --ovcopts-add=flags=+pass2 "-o=I:\Pictures\WebM\1.webm"
Playing: I:\! TV\Trailer Park Boys\Season 06\Trailer Park Boys - S06E05 - Halloween 1977 - DVD - x264 AC3.mkv
(+) Video --vid=1 (*) (h264 720x476 29.970fps)
Audio --aid=1 --alang=eng (*) (ac3 6ch 48000Hz)
VO: [lavc] 720x476 => 720x535 yuv420p
[vo/lavc] Reading 2-pass log: I:\Pictures\WebM\1.webm-video-pass1.log
[file] Cannot open file 'I:\Pictures\WebM\1.webm-video-pass1.log': No such file or directory
Failed to open I:\Pictures\WebM\1.webm-video-pass1.log.
[vo/lavc] could not open 'I:\Pictures\WebM\1.webm-video-pass1.log', disabling 2-pass encoding at pass 2
[vo/lavc] Opening encoder: libvpx VP8 [libvpx]
[encode] Opening output file: I:\Pictures\WebM\1.webm
[encode] Opening muxer: WebM [webm]
V: 00:01:20 / 00:22:39 (5%) {0.0min 53.7fps 2.1MB}
[encode] video: encoded 2764143 bytes
[encode] audio: encoded 0 bytes
[encode] muxing overhead 2994 bytes
Exiting... (End of file)
Apparently it doesn't happen when I use the same script to convert to MP4, the problem seems to only happen when using WEBM as output.
Top = source, bottom is output MP4.
Well, your video isn't 4:3, but actually 8:9. I don't know if VP8 specifically forces an aspect ratio, but as you said that using MP4 as the output format, I'd assume so.
Well, your video isn't 4:3, but actually 8:9. I don't know if VP8 specifically forces an aspect ratio, but as you said that using MP4 as the output format, I'd assume so.
yeah sorry, it's not 4:3, but is there a way to prevent VP8 from ruining the aspect ratio?
I hope so. Could you upload the clip you made, in MP4? I want to see if ffmpeg also forces the aspect ratio when using VP8.
I hope so. Could you upload the clip you made, in MP4? I want to see if ffmpeg also forces the aspect ratio when using VP8.
Someone pointed out this might be the issue: libvpx vpxenc.c#L1037
ffmpeg doesn't have this issue, apparently. Using:
ffmpeg.exe -i 89input.mp4 -c:v libvpx -c:a libvorbis 89output.webm
Results in a video with correct proportions.
ffmpeg doesn't have this issue, apparently. Using:
ffmpeg.exe -i 89input.mp4 -c:v libvpx -c:a libvorbis 89output.webm
Results in a video with correct proportions.
then how do I get this webm script for mpv to do the same?
I don't know. Looking deeper on it, this seems more like a bug on ffmpeg/mpv itself. mpv passes the SAR (along with other codec parameters) in the codecpar
field on the AVStream
struct. Starting from the mpv code:
AVCodecContext
struct here;AVCodecParameters
struct; these parameters are then copied into the AVStream
struct here.Now, we begin looking at the ffmpeg side of the things:
sample_aspect_ratio
field in the AVStream
struct (which wasn't set by mpv), while the MOV container reads it from from the sample_aspect_ratio
in the codecpar
field, which was set by mpv. I'm pretty sure this is why MP4 output works, and why WebM output doesn't.init_muxer
function, which is called by avformat_write_header
(via avformat_init_output
), it actually checks whether both fields differ, and warns about it... Well, unless only one of them is set. If this happens, the "unset" value (at least when the AVStream
sample_aspect_ratio
one is unset) will default to a numerator of 0 and a denominator of 1, and the warning won't go off.I will probably build mpv myself to test my theory, when I have some time...
edit: I've submitted this PR to mpv, which should fix this.
Fixed in upstream.
mpv version and platform
Windows 10 Enterprise v.1809
Description
Creating a webm using source material that is 8:9 make the webm output stretched widescreen video screenshot showing source on top, output webm on bottom![screenshot](https://user-images.githubusercontent.com/17074394/62426583-dd1e6200-b6e6-11e9-8470-69150a297899.jpg)
Log file
log file