gpt4 book ai didi

macos - FFmpeg 视频在 QuickPlayer 上不起作用(因此在 OpenCV 上)

转载 作者:行者123 更新时间:2023-12-02 16:37:51 29 4
gpt4 key购买 nike

我知道有几篇关于 FFMpeg 无法在 QuickPlayer(和 OpenCV)和其他仅支持 YUV 平面颜色空间的播放器上运行的帖子,但我发现没有一个解决方案对我有用。

我需要它在 OpenCV 上运行,但据我发现,如果它不在 QuickPlayer 上运行,它将永远不会在 OpenCV 上运行,所以,我想我可能会开始修复 QuickPlayer 问题。生成的视频是屏幕记录,在 VLC 上完美运行。

使用的配置:

MacOs High Sierra
ffmpeg version 4.0 (installed with: --with-opus --with-libvpx )
opencv version 3.4.1_4
Homebrew 1.6.2 (used to install ffmpeg and opencv)

用于录制视频的命令:
ffmpeg -f avfoundation -video_size 1980x1140 -framerate 30 -i '1' 
-vcodec libx264 -preset ultrafast -an -qp 0 -pix_fmt yuv444p video.mkv -y

注1:我已经尝试更改 -pix_fmtyuv420p
注2:我已经尝试添加 -vf scale=640:-2,format=yuv420p
注意 3:我已经尝试重新安装 OpenCV --with-ffmpeg
注4:我试过 mkv , mp4 , avi .我真的不在乎扩展,我只需要它工作。

注意5:我需要它是一个跨平台的解决方案,据我所知,ffmpeg 应该适用于所有操作系统,但首先我尝试在 mac 上修复,然后我会检查其他...

有任何想法吗?也许是丢失的标志?一个失踪的图书馆?

@Gyan 建议我将 qp 标志更改为大于 0 的数字,我做到了
ffmpeg -f avfoundation -video_size 1980x1140 -framerate 30 -i '1' -vcodec libx264 -preset ultrafast -an -qp 2 -pix_fmt yuv444p video_test.mp4 -y

这是我的输出:

ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-frei0r --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.0/include/openjpeg-2.3 --enable-nonfree
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[avfoundation @ 0x7fbb8f80ee00] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fbb8f80ee00] Supported pixel formats:
[avfoundation @ 0x7fbb8f80ee00] uyvy422
[avfoundation @ 0x7fbb8f80ee00] yuyv422
[avfoundation @ 0x7fbb8f80ee00] nv12
[avfoundation @ 0x7fbb8f80ee00] 0rgb
[avfoundation @ 0x7fbb8f80ee00] bgr0
[avfoundation @ 0x7fbb8f80ee00] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7fbb8f80ee00] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '1':
Duration: N/A, start: 118955.291667, bitrate: N/A
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1440x900, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mp4 @ 0x7fbb8f87d200] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 @ 0x7fbb8f87f600] MB rate (5130000000) > level limit (16711680)
[libx264 @ 0x7fbb8f87f600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fbb8f87f600] profile High 4:4:4 Predictive, level 6.2, 4:4:4 8-bit
[libx264 @ 0x7fbb8f87f600] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=2 ip_ratio=1.40 aq=0
Output #0, mp4, to 'video_test.mp4':
Metadata:
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1440x900, q=-1--1, 1000k fps, 1000k tbn, 1000k tbc
Metadata:
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

最佳答案

我能够让它在 OpenCV(不是 QuickPlayer)上运行。

This帮了我很多,因为我的 OpenCV 安装错误(未与 ffmpeg 链接)。
我不得不 brew install opencv --with-ffmpeg -vbrew link --overwrite opencv .

我将 qp 更改为 2 并从源代码重建了 ffmpeg。

感谢@zindarod 和@Gyan

关于macos - FFmpeg 视频在 QuickPlayer 上不起作用(因此在 OpenCV 上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50139655/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com