facebookresearch / VideoPose3D

Efficient 3D human pose estimation in video using 2D keypoint trajectories
Other
3.67k stars 748 forks source link

Error in rendering a custom video #153

Open wesonchen opened 3 years ago

wesonchen commented 3 years ago

When i render my own video,there occur the following error in step 5:

raise subprocess.CalledProcessError( subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x600', '-pix_fmt', 'rgba', '-r', '50.0', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '3000k', '-y', 'res.mp4']' returned non-zero exit status 1. How can i fix it?

Following is the full error:

Loading dataset... Preparing data... Loading 2D detections... <numpy.lib.npyio.NpzFile object at 0x00000171601365E0> INFO: Receptive field: 243 frames INFO: Trainable parameter count: 16952371 Loading checkpoint checkpoint\pretrained_h36m_detectron_coco.bin This model was trained for 80 epochs INFO: Testing on 1460 frames Rendering... INFO: this action is unlabeled. Ground truth will not be rendered. ffmpeg version 4.3 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9.3.1 (GCC) 20200621 configuration: --disable-static --enable-shared --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-libopenmpt --enable-amf 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 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\admin\pose3d\VideoPose3D-master\inference\input_directory\output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.45.100 Duration: 00:00:29.20, start: 0.000000, bitrate: 2015 kb/s Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 2013 kb/s, 50 fps, 50 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : ISO Media file produced by Google Inc. Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> rawvideo (native)) Press [q] to stop, [?] for help Output #0, image2pipe, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.45.100 Stream #0:0(und): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2488320 kb/s, 50 fps, 50 tbn, 50 tbc (default) Metadata: handler_name : ISO Media file produced by Google Inc. encoder : Lavc58.91.100 rawvideo frame= 1460 fps= 64 q=-0.0 Lsize= 8869500kB time=00:00:29.20 bitrate=2488320.0kbits/s speed=1.28x video:8869500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000% C:\Users\admin\pose3d\VideoPose3D-master\common\visualization.py:198: 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: [h264_amf @ 00000205b219a340] DLL amfrt64.dll failed to open 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 "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 251, in saving yield self File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 1145, in save writer.grab_frame(savefig_kwargs) File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 363, in grab_frame self.fig.savefig(self._frame_sink(), format=self.frame_format, File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\figure.py", line 2311, in savefig self.canvas.print_figure(fname, kwargs) File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\backend_bases.py", line 2210, in print_figure result = print_method( File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\backend_bases.py", line 1639, in wrapper return func(*args, kwargs) File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\backends\backend_agg.py", line 456, in print_rawfh.write(renderer.buffer_rgba()) OSError: [Errno 22] Invalid argument During handling of the above exception, another exception occurred: Traceback (most recent call last): File "run.py", line 779, in render_animation(input_keypoints, keypoints_metadata, anim_output, File "C:\Users\admin\pose3d\VideoPose3D-master\common\visualization.py", line 206, in render_animation anim.save(output, writer=writer) File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 1145, in save writer.grab_frame(savefig_kwargs) File "E:\Anaconda3\envs\pose3d\lib\contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 253, in saving self.finish() File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 354, in finish self.cleanup() File "E:\Anaconda3\envs\pose3d\lib\site-packages\matplotlib-3.3.1-py3.8-win-amd64.egg\matplotlib\animation.py", line 390, in cleanup raise subprocess.CalledProcessError( subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x600', '-pix_fmt', 'rgba', '-r', '50.0', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '3000k', '-y', 'res.mp4']' returned non-zero exit status 1.

ivanlorusso commented 3 years ago

I think I'm having the same issue, this is the full output:


Loading dataset...
Preparing data...
Loading 2D detections...
INFO: Receptive field: 243 frames
INFO: Trainable parameter count: 16952371
Loading checkpoint checkpoint/pretrained_h36m_detectron_coco.bin
This model was trained for 80 epochs
INFO: Testing on 1113 frames
Rendering...
INFO: this action is unlabeled. Ground truth will not be rendered.
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.2.0 (crosstool-NG fa8859cb)
  configuration: --prefix=/home/ec2-user/anaconda3/envs/JupyterSystemEnv --cc=/tmp/build/80754af9/ffmpeg_1526323631431/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --enable-shared --enable-static --enable-zlib --enable-pic --enable-gpl --enable-version3 --disable-nonfree --enable-hardcoded-tables --enable-avresample --enable-libfreetype --disable-openssl --disable-gnutls --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --disable-libx264
  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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inference/input_directory/output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
  Duration: 00:00:37.17, start: 2.869000, bitrate: 1378 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 1375 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
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.12.100
    Stream #0:0(und): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1491500 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.18.100 rawvideo
frame= 1113 fps=105 q=-0.0 Lsize= 6761475kB time=00:00:37.13 bitrate=1491500.5kbits/s speed=3.51x    
video:6761475kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
MovieWriter stderr:
Unknown encoder 'h264'

Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 230, in saving
    yield self
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 1156, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 384, in grab_frame
    dpi=self.dpi, **savefig_kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 2082, in print_figure
    **kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 446, in print_raw
    fh.write(renderer._renderer.buffer_rgba())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 782, in <module>
    input_video_skip=args.viz_skip)
  File "/home/ec2-user/SageMaker/VideoPose3D/common/visualization.py", line 204, in render_animation
    anim.save(output, writer=writer)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 1156, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 232, in saving
    self.finish()
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 367, in finish
    self.cleanup()
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/matplotlib/animation.py", line 411, in cleanup
    self._proc.returncode, self._proc.args, out, err)
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x600', '-pix_fmt', 'rgba', '-r', '29.97002997002997', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '3000k', '-y', 'output_final.mp4']' returned non-zero exit status 1.```
dariopavllo commented 3 years ago

Your build of ffmpeg was built without h264 encoding support. Try to download it from another source (e.g. either conda or the official website).

ivanlorusso commented 3 years ago

Your build of ffmpeg was built without h264 encoding support. Try to download it from another source (e.g. either conda or the official website).

I did actually, I also checked and h264 encoding is supported.

dariopavllo commented 3 years ago

From your log, I see the compiler flag --disable-libx264 and the line Unknown encoder 'h264'. Could it be that you have multiple ffmpeg executables lying around and your Python distribution is picking up the wrong one?

wesonchen commented 3 years ago

From your log, I see the compiler flag --disable-libx264 and the line Unknown encoder 'h264'. Could it be that you have multiple ffmpeg executables lying around and your Python distribution is picking up the wrong one?

hello,there is another problem i have,can you help me?

Loading dataset...
Preparing data...
Loading 2D detections...
<numpy.lib.npyio.NpzFile object at 0x000001C6BF1755E0>
Traceback (most recent call last):
  File "run.py", line 170, in <module>
    cameras_valid, poses_valid, poses_valid_2d = fetch(subjects_test, action_filter)
  File "run.py", line 116, in fetch
    for action in keypoints[subject].keys():
KeyError: 'output.mp4'
wesonchen commented 3 years ago

@ivanlorusso You can try to degrade the version of ffmpeg or reinstall it. When i degrade the version to 2.7.0. The error disappear.

UsamaHasan commented 3 years ago

@wesonchen I'm getting the same error, any leads on this.

UsamaHasan commented 3 years ago

So during custom dataset creation for inference in the wild, if you enter the path of the video instead of the folder path which contains the detectron output this error pops up, also you have to set the actually name of the file there --viz-subject.

rohit-kumar-j commented 2 years ago

@UsamaHasan check this example: https://colab.research.google.com/github/Justinemmerich/VideoPose3D/blob/master/Notebook/Facebook_VideoPose3D_Inference_in_the_wild_Detectron.ipynb#scrollTo=rbImoAtIRxdu

UsamaHasan commented 2 years ago

@rohit-kumar-j thanks already solved that.

thekryz commented 2 years ago

I have the same issue as OP:

(videopose3d) myself@myself-Z440:~/projects/videopose3d/VideoPose3D/data$ python prepare_data_2d_custom.py -i ../inference/myself_test/output -o myself_test
Parsing 2D detections from ../inference/myself_test/output
Processing ../inference/myself_test/output/test_myself.mp4.npz
643 total frames processed
0 frames were interpolated
----------
Saving...
Done.
(videopose3d) myself@myself-Z440:~/projects/videopose3d/VideoPose3D/data$ cd ..
(videopose3d) myself@myself-Z440:~/projects/videopose3d/VideoPose3D$ python run.py -d custom -k myself_test -arc 3,3,3,3,3 -c checkpoint --evaluate pretrained_h36m_detectron_coco.bin --render --viz-subject test_myself.mp4 --viz-action custom --viz-camera 0 --viz-video inference/myself_test/input/test_myself.mp4 --viz-output test_myself_3d.mp4 --viz-size 6
Namespace(dataset='custom', keypoints='myself_test', subjects_train='S1,S5,S6,S7,S8', subjects_test='S9,S11', subjects_unlabeled='', actions='*', checkpoint='checkpoint', checkpoint_frequency=10, resume='', evaluate='pretrained_h36m_detectron_coco.bin', render=True, by_subject=False, export_training_curves=False, stride=1, epochs=60, batch_size=1024, dropout=0.25, learning_rate=0.001, lr_decay=0.95, data_augmentation=True, test_time_augmentation=True, architecture='3,3,3,3,3', causal=False, channels=1024, subset=1, downsample=1, warmup=1, no_eval=False, dense=False, disable_optimizations=False, linear_projection=False, bone_length_term=True, no_proj=False, viz_subject='test_myself.mp4', viz_action='custom', viz_camera=0, viz_video='inference/myself_test/input/test_myself.mp4', viz_skip=0, viz_output='test_myself_3d.mp4', viz_export=None, viz_bitrate=3000, viz_no_ground_truth=False, viz_limit=-1, viz_downsample=1, viz_size=6)
Loading dataset...
Preparing data...
Loading 2D detections...
INFO: Receptive field: 243 frames
INFO: Trainable parameter count: 16952371
Loading checkpoint checkpoint/pretrained_h36m_detectron_coco.bin
This model was trained for 80 epochs
INFO: Testing on 643 frames
Rendering...
INFO: this action is unlabeled. Ground truth will not be rendered.
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/myself/miniconda3/envs/videopose3d --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 'inference/myself_test/input/test_myself.mp4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2022-03-18T10:49:22.000000Z
  Duration: 00:00:21.45, start: 0.000000, bitrate: 102563 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 4352x2488 [SAR 1:1 DAR 544:311], 100412 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2022-03-18T10:49:22.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Ambarella AVC encoder
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2022-03-18T10:49:22.000000Z
      handler_name    :  Ambarella AAC
    Stream #0:2(eng): Subtitle: mov_text (text / 0x74786574), 3 kb/s (default)
    Metadata:
      creation_time   : 2022-03-18T10:49:22.000000Z
      handler_name    :  Ambarella EXT
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[swscaler @ 0x55be3926a140] deprecated pixel format used, make sure you did set range correctly
Output #0, image2pipe, to 'pipe:':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: rawvideo (RGB[24] / 0x18424752), rgb24, 4352x2488 [SAR 1:1 DAR 544:311], q=2-31, 7788210 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2022-03-18T10:49:22.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Lavc58.91.100 rawvideo
frame=  643 fps= 28 q=-0.0 Lsize=20397246kB time=00:00:21.45 bitrate=7788210.4kbits/s speed=0.949x    
video:20397246kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
/home/myself/projects/videopose3d/VideoPose3D/common/visualization.py:198: 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 @ 0x555dbaee3dc0] 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/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 236, in saving
    yield self
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 1095, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 353, in grab_frame
    self.fig.savefig(self._proc.stdin, format=self.frame_format,
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/figure.py", line 3019, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 2319, in print_figure
    result = print_method(
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/backend_bases.py", line 1648, in wrapper
    return func(*args, **kwargs)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/_api/deprecation.py", line 412, in wrapper
    return func(*inner_args, **inner_kwargs)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py", line 486, in print_raw
    fh.write(renderer.buffer_rgba())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myself/projects/videopose3d/VideoPose3D/run.py", line 778, in <module>
    render_animation(input_keypoints, keypoints_metadata, anim_output,
  File "/home/myself/projects/videopose3d/VideoPose3D/common/visualization.py", line 204, in render_animation
    anim.save(output, writer=writer)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 1095, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 238, in saving
    self.finish()
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 344, in finish
    self._cleanup()  # Inline _cleanup() once cleanup() is removed.
  File "/home/myself/miniconda3/envs/videopose3d/lib/python3.9/site-packages/matplotlib/animation.py", line 375, in _cleanup
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x600', '-pix_fmt', 'rgba', '-r', '29.97002997002997', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-b', '3000k', '-y', 'test_myself_3d.mp4']' returned non-zero exit status 1.

My ffmpeg seems to have h264 activated, the --viz_subject test_myself.mp4 is the correct filename and I think I also correctly handled the points that @UsamaHasan made. Whatelse could be the problem?

thekryz commented 2 years ago

After updating my conda packages, the error looks a bit different:

(videopose3d) myself@myself-Z440:~/projects/videopose3d/VideoPose3D$ python run.py -d custom -k 2020_02_26-12_00 -arc 3,3,3,3,3 -c checkpoint --evaluate pretrained_h36m_detectron_coco.bin --render --viz-subject left.mp4 --viz-action custom --viz-camera 0 --viz-video '/media/veracrypt1/04 - Fixed video file for MEA X/left/left.mp4' --viz-output '/media/veracrypt1/04 - Fixed video file for MEA X/left/left_output.mp4' --viz-size 6 
Namespace(dataset='custom', keypoints='2020_02_26-12_00', subjects_train='S1,S5,S6,S7,S8', subjects_test='S9,S11', subjects_unlabeled='', actions='*', checkpoint='checkpoint', checkpoint_frequency=10, resume='', evaluate='pretrained_h36m_detectron_coco.bin', render=True, by_subject=False, export_training_curves=False, stride=1, epochs=60, batch_size=1024, dropout=0.25, learning_rate=0.001, lr_decay=0.95, data_augmentation=True, test_time_augmentation=True, architecture='3,3,3,3,3', causal=False, channels=1024, subset=1, downsample=1, warmup=1, no_eval=False, dense=False, disable_optimizations=False, linear_projection=False, bone_length_term=True, no_proj=False, viz_subject='left.mp4', viz_action='custom', viz_camera=0, viz_video='/media/veracrypt1/04 - Fixed video file for MEA X/left/left.mp4', viz_skip=0, viz_output='/media/veracrypt1/04 - Fixed video file for MEA X/left/left_output.mp4', viz_export=None, viz_bitrate=3000, viz_no_ground_truth=False, viz_limit=-1, viz_downsample=1, viz_size=6)
Loading dataset...
Preparing data...
Loading 2D detections...
INFO: Receptive field: 243 frames
INFO: Trainable parameter count: 16952371
Loading checkpoint checkpoint/pretrained_h36m_detectron_coco.bin
This model was trained for 80 epochs
INFO: Testing on 19040 frames
Rendering...
INFO: this action is unlabeled. Ground truth will not be rendered.
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/myself/miniconda3/envs/videopose3d --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 '/media/veracrypt1/04 - Fixed video file for MEA X/left/left.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:05:17.65, start: 0.000000, bitrate: 128344 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1352x1520, 128137 kb/s, SAR 1:1 DAR 169:190, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 195 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, 1352x1520 [SAR 1:1 DAR 169:190], q=2-31, 2956301 kb/s, 59.94 fps, 59.94 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.91.100 rawvideo
av_interleaved_write_frame(): Broken pipeB time=00:01:17.41 bitrate=2956301.3kbits/s speed=0.31x     
Error writing trailer of pipe:: Broken pipetime=00:01:17.42 bitrate=2955735.4kbits/s speed=0.264x    
frame= 4641 fps= 15 q=-0.0 Lsize=27936372kB time=00:01:17.42 bitrate=2955735.4kbits/s speed=0.251x    
video:27941721kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
Getötet

As you can see, the error is now written into previous messages Please excuse the partial German at the end - "Getötet" means "killed".

tghim commented 2 years ago

I also had a similar problem. Although it may not be suitable for this situation and the method I have solved is not a neat one, I am posting a link in case it helps. [Error in making animation through ffmpeg (python3.9)](https://stackoverflow.com/questions/72596662/error-in-making-animation-through-ffmpeg-python3-9)

khm159 commented 1 year ago

I fixed it re-install ffmpeg using conda (not sudo apt-get or pip)

conda install ffmpeg

cohyun commented 1 year ago

Hi :) I got this prob when i run run.py exporting ouput by gif. If I run run.py exporting output by mp4, this error code doesn't appear. You guys should try reinstalling ffmpeg or exporting output by mp4