это мой первый вопрос! здорово! Так что я новичок в python, и я работаю над какой-то программой для работы. У меня есть Elgato CamLink 4k, подключенный к Sony A7III. Я ищу лучший способ записать видеофайл из канала camlink, используя python. Я знаю, что ffmpeg - хороший способ записать канал веб-камеры. но у меня проблемы с этим, вот мой код.
import ffmpeg
(
ffmpeg
.input('0', format='avfoundation', pix_fmt='nv12', framerate=25)
.output('test.mp4', pix_fmt='nv12', vframes=125)
.overwrite_output()
.run()
)
я использую этот ffmpeg- python модуль
я получаю выходной файл только с первым кадр и ничего более
вот что я получаю в терминале запуска
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.3 (clang-1103.0.32.62)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --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-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
[avfoundation @ 0x7ff043814600] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '0':
Duration: N/A, start: 6247.240967, bitrate: N/A
Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 3840x2160, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mp4 @ 0x7ff043856c00] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 @ 0x7ff043868000] MB rate (32400000000) > level limit (16711680)
[libx264 @ 0x7ff043868000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7ff043868000] profile High, level 6.2, 4:2:0, 8-bit
[libx264 @ 0x7ff043868000] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), nv12, 3840x2160, q=-1--1, 1000k fps, 1000k tbn, 1000k tbc
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 125 fps= 30 q=-1.0 Lsize= 788kB time=00:00:00.00 bitrate=52509528.5kbits/s dup=124 drop=1 speed=2.99e-05x
video:786kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.290685%
[libx264 @ 0x7ff043868000] frame I:1 Avg QP:19.49 size:588332
[libx264 @ 0x7ff043868000] frame P:31 Avg QP:20.24 size: 4202
[libx264 @ 0x7ff043868000] frame B:93 Avg QP:33.28 size: 922
[libx264 @ 0x7ff043868000] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 @ 0x7ff043868000] mb I I16..4: 2.8% 86.0% 11.3%
[libx264 @ 0x7ff043868000] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 6.9% 0.3% 0.5% 0.0% 0.0% skip:92.3%
[libx264 @ 0x7ff043868000] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 4.4% 0.0% 0.0% direct: 0.0% skip:95.6% L0:19.0% L1:81.0% BI: 0.0%
[libx264 @ 0x7ff043868000] 8x8 transform intra:86.0% inter:88.3%
[libx264 @ 0x7ff043868000] coded y,uvDC,uvAC intra: 93.8% 87.1% 55.6% inter: 0.1% 1.5% 0.0%
[libx264 @ 0x7ff043868000] i16 v,h,dc,p: 9% 10% 9% 72%
[libx264 @ 0x7ff043868000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 14% 34% 6% 5% 5% 6% 7% 7%
[libx264 @ 0x7ff043868000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 18% 16% 9% 8% 7% 8% 7% 6%
[libx264 @ 0x7ff043868000] i8c dc,h,v,p: 48% 26% 20% 6%
[libx264 @ 0x7ff043868000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7ff043868000] ref P L0: 82.6% 0.1% 14.0% 3.3%
[libx264 @ 0x7ff043868000] ref B L0: 99.8% 0.2% 0.0%
[libx264 @ 0x7ff043868000] ref B L1: 76.2% 23.8%
[libx264 @ 0x7ff043868000] kb/s:51475456.00
если я отключаю camlink, я получаю видео с внутренней камеры macbook. поэтому я знаю, что это должно как-то работать