Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python demo_video.py "****.mp4" occurs to error called OSFailed #74

Open
bibibabibo26 opened this issue Sep 9, 2022 · 2 comments
Open

Comments

@bibibabibo26
Copy link

python demo_video.py --file "PXL_20220824_135947155.mp4"
ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutl
s --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libweb
p --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-lib
fribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nve
nc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 589938 kb/s
Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 853x480, 589938 kb/s, 60.04 tbr, 60.04 tbn
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
[swscaler @ 00000214048bb9c0] [swscaler @ 00000214048d23c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 000002140491d780] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404aad580] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404af1d00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404b36180] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404b83180] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404bc6c00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404c12e80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404c3fe80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404ca00c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404d02040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404d52040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404d60cc0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404dd7040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404df0740] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404e56040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000214048bb9c0] [swscaler @ 0000021404e7b040] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 000002140486f000] width not divisible by 2 (853x480)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Traceback (most recent call last):
File "D:\project\OpenPose\demo_video.py", line 133, in
writer(posed_frame)
File "D:\project\OpenPose\demo_video.py", line 109, in call
self.ff_proc.stdin.write(frame.tobytes())
OSError: [Errno 22] Invalid argument

how to solve it?please.
怎么解决这个问题,是ffmpeg-python的错误吗

@sibadakesi
Copy link

Use cv2.imencode(".jpg", frame)[1].tobytes() to replace frame.tobytes()

@sibadakesi
Copy link

或者你直接保存输出图片,然后用ffmpeg转成视频

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants