fabro66 / GAST-Net-3DPoseEstimation

A Graph Attention Spatio-temporal Convolutional Networks for 3D Human Pose Estimation in Video (GAST-Net)
MIT License
314 stars 69 forks source link

[BUG] 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 #52

Closed 59-StarDestroyer closed 2 years ago

59-StarDestroyer commented 3 years ago

Got some errors while generating rendering animation: 在运行[基于RGB视频的人体3D姿态估计]时,发生了一些错误 python gen_skes.py -v baseball.mp4 -np 1 --animation Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'. Then I passe 'auto' instead of 'equal', the error above was solved 我按照Issues中同样的问题,将equal改为了auto But I still have problems running the code 但是依然无法生成可视化的视频文件

(3DS) hp@user:~/GAST-Net-3DPoseEstimation$  python gen_skes.py -v baseball.mp4 -np 1 --animation
Loading YOLOv3 network.....
YOLOv3 network successfully loaded
Loading HRNet model ...
HRNet network successfully loaded
Generating 2D pose ...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 277/277 [00:16<00:00, 17.09it/s]
Loading GAST-Net ...
GAST-Net successfully loaded
Generating 3D human pose ...
Generating animation ...
ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7.3.0 (crosstool-NG 1.23.0.449-a04d0)
  configuration: --prefix=/home/hp/.conda/envs/3DS --cc=/opt/conda/conda-bld/ffmpeg_1597178665428/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-pic --enable-pthreads --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libmp3lame
  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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/hp/GAST-Net-3DPoseEstimation/data/video/baseball.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:12.01, start: 0.008005, bitrate: 3798 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 3807 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, image2pipe, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
    Stream #0:0(und): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1193200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.91.100 rawvideo
frame=  277 fps= 40 q=-0.0 Lsize= 1682775kB time=00:00:12.09 bitrate=1139712.1kbits/s speed=1.76x    
video:1682775kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
/home/hp/GAST-Net-3DPoseEstimation/tools/vis_h36m.py:238: UserWarning: Tight layout not applied. The left and right margins cannot be made large enough to accommodate all axes decorations. 
  fig.tight_layout()
MovieWriter stderr:
[libopenh264 @ 0x559c7dbbf1c0] Incorrect library version loaded
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

Traceback (most recent call last):
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 251, in saving
    yield self
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 1157, in save
    anim._draw_next_frame(d, blit=False)
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 1192, in _draw_next_frame
    self._draw_frame(framedata)
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 1742, in _draw_frame
    self._drawn_artists = self._func(framedata, *self._args)
  File "/home/hp/GAST-Net-3DPoseEstimation/tools/vis_h36m.py", line 232, in update_video
    lines_3d[n][j - 1][0].set_3d_properties([pos[j, 2], pos[j_parent, 2]], zdir='z')
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/mpl_toolkits/mplot3d/art3d.py", line 143, in set_3d_properties
    zs = np.broadcast_to(zs, xs.shape)
AttributeError: 'list' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gen_skes.py", line 180, in <module>
    generate_skeletons(video=video_path, output_animation=args.animation, num_person=args.num_person)
  File "gen_skes.py", line 155, in generate_skeletons
    viz_output, input_video_path=video, viewport=(width, height), com_reconstrcution=same_coord)
  File "/home/hp/GAST-Net-3DPoseEstimation/tools/vis_h36m.py", line 244, in render_animation
    anim.save(output, writer=writer)
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 1161, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/hp/.conda/envs/3DS/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 253, in saving
    self.finish()
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 354, in finish
    self.cleanup()
  File "/home/hp/.conda/envs/3DS/lib/python3.6/site-packages/matplotlib/animation.py", line 391, in cleanup
    self._proc.returncode, self._proc.args, out, err)
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1000x500', '-pix_fmt', 'rgba', '-r', '25', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '30000k', '-y', './output/animation_baseball.mp4']' returned non-zero exit status 1.

I ran the code on a cloud server(OS:Ubuntu 18.04.3 LTS), I thought something wrong with the ffmpeg. After I reinstalled it(ffmpeg version 4.3), it didnt work. 我在服务器上运行这些代码,我以为是ffmpeg的问题,但是当我重新安装ffmpeg后并没什么用。 Anyway, Generating 3D joint coordinates codes does work fine, had some problems in visualizing the predictions. 不过生成3D姿态骨架文件的代码可以正常运行并生成npz文件,问题是在生成可视化视频时发生的。 Anyone can help? Thanks in advance!

59-StarDestroyer commented 3 years ago

Solved by installing the newest ffmpeg, and pip install matplotlib==3.1.1 I have no idea why my ffmpeg doesnt work at conda virtual. If someone has the same problem, please try running the code on base.

KeonAcute commented 2 years ago

Solved by installing the newest ffmpeg, and pip install matplotlib==3.1.1 I have no idea why my ffmpeg doesnt work at conda virtual. If someone has the same problem, please try running the code on base

请问你最后解决时对应的ffmpeg版本是多少,我也是因为这个问题报错。另外,matplotlib的版本必须是3.1.1的吗?谢谢

59-StarDestroyer commented 2 years ago

@KeonAcute ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) 建议安装3.1.1版本的matplotlib,不知道什么原因,在conda虚拟环境下运行会报错,同时建议在base环境下运行。