Кодирование ffmpeg в VP9 приводит к невозможности воспроизведения видео в Google Chrome, в то время как к VP8 работает

1054
TranslucentCloud

Прошло много времени, так как я столкнулся с проблемой, указанной в теме.

Я попробовал несколько ffmpegстатических сборок, сам собрал их из репозитория Git с разными флагами и на всех основных операционных системах, даже собранных libvpx, но проблема все еще сохраняется. Я не могу заставить ffmpeg кодировать VP9видео, которое не приведет к сбою Google Chrome.

У меня есть Intel Core 2 Quad Q9550с 4 ядрами, и, например, я использую brew-built ffmpegсо следующими параметрами:

ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.1_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 

рассматриваемое видео:

General  Complete name : OneSecondTestYUV422.mov Format : MPEG-4 Format profile : QuickTime Codec ID : qt File size : 13.0 MiB Duration : 1s 0ms Overall bit rate mode : Variable Overall bit rate : 109 Mbps Movie name : Untitled Project Description : This video is about Untitled Project Encoded date : UTC 2015-10-17 16:43:21 Tagged date : UTC 2015-10-17 16:43:22 Writing library : Apple QuickTime com.apple.quicktime.keywords : ProRes Samples com.apple.quicktime.author : No Name com.apple.quicktime.title : Untitled Project  Video  ID : 1 Format : ProRes Format version : Version 0 Format profile : 422 Codec ID : apcn Duration : 1s 0ms Bit rate mode : Variable Bit rate : 106 Mbps Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 24.000 fps Color space : YUV Chroma subsampling : 4:2:2 Scan type : Progressive Bits/(Pixel*Frame) : 2.138 Stream size : 12.7 MiB (98%) Title : Core Media Video Writing library : Apple Encoded date : UTC 2015-10-17 16:43:21 Tagged date : UTC 2015-10-17 16:43:22 Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709  Audio  ID : 2 Format : PCM Format settings, Endianness : Little Format settings, Sign : Signed Codec ID : lpcm Duration : 1s 0ms Bit rate mode : Constant Bit rate : 2 304 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Bit depth : 24 bits Stream size : 281 KiB (2%) Title : Core Media Audio Encoded date : UTC 2015-10-17 16:43:21 Tagged date : UTC 2015-10-17 16:43:22  Other  ID : 3 Type : Time code Format : QuickTime TC Duration : 1s 0ms Time code of first frame : 00:00:00:00 Time code, striped : Yes Title : Core Media Time Code Encoded date : UTC 2015-10-17 16:43:22 Tagged date : UTC 2015-10-17 16:43:22 

и команда, которую я передаю ffmpeg:

ffmpeg -i OneSecondTestYUV422.mov -map 0:0 -map 0:1 -c:a libvorbis -async 1 -c:v libvpx-vp9 -b:v 17418.24k -maxrate 34836.48k -bufsize 34836.48k -r 24 -s 1920x1080 -aspect 16:9 -trellis 0 -subq 6 -me_range 16 -b_strategy 1 -refs 3 -sws_flags fast_bilinear -direct-pred 1 -sc_threshold 40 -qmin 2 -qmax 51 -copyts -threads 4 -sn -y UnplayableResult.webm 

Я много искал в Интернете, включая эти сайты, но безрезультатно.

2
`-trellis 0 -subq 6 -me_range 16 -b_strategy 1 -refs 3 -direct-pred 1 -sc_threshold 40`. Все они похожи на параметры libx264 (которые в любом случае не нужны 99,9% времени из-за предустановок x264). Эти параметры будут игнорироваться `libvpx-vp9`. LordNeckbeard 8 лет назад 1
Спасибо, я на самом деле сделал тесты с `iFFmpeg`, поэтому эти посторонние параметры вставляются им по умолчанию. Моя фактическая строка кодирования - это `ffmpeg -i OneSecondTestYUV422.mov -c: v libvpx-vp9 -b: v 4M -pix_fmt yuv420p -speed 4-параллельные рамки 0-нитей 4 -c: libopus -b: 320K PlayableResult. webm` TranslucentCloud 8 лет назад 0
Это выглядит более вменяемым. Никогда не слышал о iFFmpeg. LordNeckbeard 8 лет назад 0
iFFmpeg - это просто еще один платный графический интерфейс ffmpeg. Использовал его только для тестов, сделал мою настоящую работу из командной строки. TranslucentCloud 8 лет назад 0

2 ответа на вопрос

3
TranslucentCloud

Seems like I figured it out (funny enough I had a problem for days and finally resolved it once the question has been published).

ffmpeg sees that the original video has pixel format YUV 4:2:2 and encodes it accordingly, to the same format. However, seems like Google Chrome doesn't work with this pixel format, and it expects it to be YUV 4:2:0.

So, I have passed -pix_fmt yuv420p to the command line and voilà, I have a Google Chrome-playable video!

Мне любопытно: вы можете показать строку `Поддерживаемые форматы пикселей` из:` ffmpeg -h encoder = libvpx-vp9`? LordNeckbeard 8 лет назад 0
Конечно, вы идете: `Поддерживаемые форматы пикселей: yuv420p yuv422p yuv440p yuv444p` TranslucentCloud 8 лет назад 0
0
Draussenduscher

I had a similar problem: Some of the WebM-VP9 videos I had encoded over the last year could be played in Firefox, some couldn't (Firefox 44, 45, Mac OS X). However Firefox 39 could play all of them!?

Thanks to TranslucentCloud's hint I finally checked some of the files using ffprobe. They just differed in yuv422p(tv) vs. yuv420p(tv).

Adding the -pix_fmt:v yuv420p option to the second run of the encoding ended my trouble. Nice, playable videos in all Firefox versions.

Похожие вопросы