|
9#
楼主 |
发表于 2022-8-13 09:42:10
|
只看该作者
本帖最后由 MWM 于 2022-8-13 09:45 编辑
有看到[size=14.6318pt]6.4 PipeCapture,这个貌似需要借助这个ffmpeg-python包。
好像需要依赖ffmpeg最新的固件貌似没有安装ffmpeg。我自己安装了跑好像会报错
- root@debian:/# ffmpeg: /lib/aarch64-linux-gnu/libOpenCL.so.1: no version information available (required by /lib/aarch64-linux-gnu/libavfilter.so.7)
- ffmpeg: /lib/aarch64-linux-gnu/libOpenCL.so.1: no version information available (required by /lib/aarch64-linux-gnu/libavfilter.so.7)
- ffmpeg: /lib/aarch64-linux-gnu/libOpenCL.so.1: no version information available (required by /lib/aarch64-linux-gnu/libavutil.so.56)
- ffmpeg: /lib/aarch64-linux-gnu/libOpenCL.so.1: no version information available (required by /lib/aarch64-linux-gnu/libavutil.so.56)
- ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
- built with gcc 10 (Debian 10.2.1-6)
- configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
- 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
- Input #0, h264, from '/home/toybrick/1080.h264':
- Duration: N/A, bitrate: N/A
- Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc
- Output #0, h264, to 'pipe:':
- Metadata:
- encoder : Lavf58.45.100
- Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
- Stream mapping:
- Stream #0:0 -> #0:0 (copy)
- Press [q] to stop, [?] for help
- av_interleaved_write_frame(): Broken pipe
- Error writing trailer of pipe:: Broken pipe
- frame= 1 fps=0.0 q=-1.0 Lsize= 84kB time=00:00:00.04 bitrate=17273.0kbits/s speed= 563x
- video:84kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
- Conversion failed!
- root@debian:/# ls ffmpeg: /lib/aarch64-linux-gnu/libOpenCL.so.1:
- ls: cannot access 'ffmpeg:': No such file or directory
- ls: cannot access '/lib/aarch64-linux-gnu/libOpenCL.so.1:': No such file or directory
- root@debian:/# /usr/lib/x86_64-linux-gnu/libOpenCL.so
- bash: /usr/lib/x86_64-linux-gnu/libOpenCL.so: No such file or directory
代码如下- import toybrick as toy
- import cv2
- import ffmpeg
- process1 = (
- ffmpeg
- .input('/home/toybrick/1080.h264')
- # .output('-', format='h264', codec='copy')
- .output('-', format='h264', codec='copy')
- .run_async(pipe_stdout=True)
- )
- disp = toy.Display("File", 1920, 1080, True)
- pipe = toy.PipeCapture(process1, toy.FMT_H264)
- pipe.start()
- while True:
- ret, frame = pipe.read(1920, 1080)
- if frame is None:
- time.sleep(0.01)
- continue
- disp.imshow(frame)
|
|