Получение странных ошибок в ffmpeg при поиске, «совместно расположенные POC недоступны», «mmco: unref short failure»
Я видел, как у других есть проблема, но не видел решения. Если я попытаюсь выполнить поиск с помощью ffmpeg, я получу несколько ошибок, и полученное видео замирает на кадре в начале перед перемещением. Даже если я открою видео в VLC, я не смогу найти точную точку, в которой возникает проблема. Вроде как то видео испортилось, но воспроизводится нормально, можно ли исправить?
Если я изменю формат контейнера ввода с ts на mp4, ошибки не возникнет, но вместо замороженного кадра у меня будет черный экран.
Полная команда и вывод:
$ ffmpeg -ss 5.5 -i video.ts -to 10 -avoid_negative_ts make_zero -vcodec libx264 -crf 23 -acodec copy output.ts
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mpegts, from 'video.ts':
Duration: 00:32:50.07, start: 1.407811, bitrate: 2227 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 117 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x7fa933003c00] co located POCs unavailable
[h264 @ 0x7fa933001800] mmco: unref short failure
[h264 @ 0x7fa931800000] co located POCs unavailable
[h264 @ 0x7fa933003c00] mmco: unref short failure
[libx264 @ 0x7fa932801000] using SAR=1/1
[libx264 @ 0x7fa932801000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fa932801000] profile High, level 3.1
Output #0, mpegts, to 'output.ts':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 117 kb/s
frame= 236 fps= 38 q=-1.0 Lsize= 2974kB time=00:00:09.98 bitrate=2439.3kbits/s speed=1.62x
video:2559kB audio:165kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.200110%
[libx264 @ 0x7fa932801000] frame I:4 Avg QP:20.49 size: 56038
[libx264 @ 0x7fa932801000] frame P:115 Avg QP:22.34 size: 15286
[libx264 @ 0x7fa932801000] frame B:117 Avg QP:24.56 size: 5452
[libx264 @ 0x7fa932801000] consecutive B-frames: 18.2% 44.1% 8.9% 28.8%
[libx264 @ 0x7fa932801000] mb I I16..4: 26.5% 32.9% 40.6%
[libx264 @ 0x7fa932801000] mb P I16..4: 7.4% 12.8% 3.4% P16..4: 30.6% 8.0% 4.0% 0.0% 0.0% skip:33.8%
[libx264 @ 0x7fa932801000] mb B I16..4: 1.5% 2.3% 1.1% B16..8: 20.9% 4.1% 0.6% direct: 3.1% skip:66.4% L0:38.0% L1:58.6% BI: 3.4%
[libx264 @ 0x7fa932801000] 8x8 transform intra:50.8% inter:63.0%
[libx264 @ 0x7fa932801000] coded y,uvDC,uvAC intra: 40.3% 71.6% 31.3% inter: 9.5% 21.8% 1.4%
[libx264 @ 0x7fa932801000] i16 v,h,dc,p: 42% 35% 15% 8%
[libx264 @ 0x7fa932801000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 25% 27% 4% 3% 3% 5% 3% 6%
[libx264 @ 0x7fa932801000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 27% 15% 6% 6% 5% 7% 5% 6%
[libx264 @ 0x7fa932801000] i8c dc,h,v,p: 42% 28% 22% 8%
[libx264 @ 0x7fa932801000] Weighted P-Frames: Y:4.3% UV:4.3%
[libx264 @ 0x7fa932801000] ref P L0: 74.0% 13.6% 9.5% 2.9% 0.1%
[libx264 @ 0x7fa932801000] ref B L0: 85.0% 13.2% 1.8%
[libx264 @ 0x7fa932801000] ref B L1: 98.3% 1.7%
[libx264 @ 0x7fa932801000] kb/s:2220.26
Ответы
Решено ... сначала:
ffmpeg -i video.ts -c copy video.mp4
а затем вместо:
ffmpeg -ss 5.5 -i video.mp4 -to 10 -avoid_negative_ts make_zero -vcodec libx264 -crf 23 -acodec copy output.ts
ты сделаешь:
ffmpeg -ss 5.5 -i video.mp4 -ss 0 -to 10 -avoid_negative_ts make_zero -vcodec libx264 -crf 23 -acodec copy output.ts