Code Monkey home page Code Monkey logo

Comments (10)

TimoBolkart avatar TimoBolkart commented on May 16, 2024

The error indicates that the output directory does not exist.
Can you please print the out_path before the subprocess call and check if the output directory exists?
In case the directory does not exist, this issue might be cause by missing permissions as the directory is supposedly created few lines above

from voca.

Wentao795 avatar Wentao795 commented on May 16, 2024

hi,thank you for you reply!
this is code:
if os.path.exists(args.out_path):
print(args.out_path)

out_video_fname = os.path.join(out_path, 'video.mp4')
cmd = ['ffmpeg', '-framerate', '60', '-pattern_type', 'glob', '-i', os.path.join(img_path, '*.png')] + cmd_audio + [out_video_fname]
call(cmd)

this is output:
./animation_visualization
Traceback (most recent call last):
File "/home/wwt/github/voca-master/visualize_sequence.py", line 69, in
call(cmd)
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
the path exisit!!!!!
please~```###

from voca.

TimoBolkart avatar TimoBolkart commented on May 16, 2024

The error indicates that one of the files or directories in the subprocess call does not exist.
Can you please check if all other paths are valid? What about img_path, cmd_audio, ...?
Did you check your ffmpeg installation? Given a folder of images, are you able to run ffmpeg from the terminal and encode the images to a video?

from voca.

Wentao795 avatar Wentao795 commented on May 16, 2024

'''
Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights on this
computer program.

You can only use this computer program if you have closed a license agreement with MPG or you get the right to use
the computer program from someone who is authorized to grant you that right.

Any use of the computer program without a valid license is prohibited and liable to prosecution.

Copyright 2019 Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V. (MPG). acting on behalf of its
Max Planck Institute for Intelligent Systems and the Max Planck Institute for Biological Cybernetics.
All rights reserved.

More information about VOCA is available at http://voca.is.tue.mpg.de.
For comments or questions, please email us at [email protected]
'''

import os
import glob
import argparse
from subprocess import call
from psbody.mesh import Mesh
from psbody.mesh.meshviewer import MeshViewer

parser = argparse.ArgumentParser(description='Sequence visualization')
parser.add_argument('--sequence_path', default='./animation_output', help='Path to motion sequence')
parser.add_argument('--audio_fname', default='./audio/test_sentence.wav', help='Path of speech sequence')
parser.add_argument('--out_path', default='./animation_visualization', help='Output path')

args = parser.parse_args()
sequence_path = args.sequence_path
audio_fname = args.audio_fname
out_path = args.out_path

if not os.path.exists(args.out_path):
os.makedirs(args.out_path)

img_path = os.path.join(out_path, 'img')
if not os.path.exists(img_path):
os.makedirs(img_path)

mv = MeshViewer()

sequence_fnames = sorted(glob.glob(os.path.join(sequence_path, '*.obj')))
if len(sequence_fnames) == 0:
print('No meshes found')
Render images

for frame_idx, mesh_fname in enumerate(sequence_fnames):
frame_mesh = Mesh(filename=mesh_fname)
mv.set_dynamic_meshes([frame_mesh], blocking=True)

img_fname = os.path.join(img_path, '%05d.png' % frame_idx)
mv.save_snapshot(img_fname)

Encode images to video

cmd_audio = []
if os.path.exists(audio_fname):
cmd_audio += ['-i', audio_fname]
print cmd_audio

if os.path.exists(args.out_path):
print(args.out_path)

out_video_fname = os.path.join(out_path, 'video.mp4')
print out_video_fname
cmd = ['ffmpeg', '-framerate', '60', '-pattern_type', 'glob', '-i', os.path.join(img_path, '*.png')] + cmd_audio + [out_video_fname]
call(cmd)

#this is the original code.
#the "animation_output" directory is *.obj file ,
#ffmpeg lib can import .
#could you tell me how to solve it ,i am not familiar with ffmpeg .
#please~~~~~~

from voca.

TimoBolkart avatar TimoBolkart commented on May 16, 2024
  1. please check first, that the folder './animation_visualization/img' exists and contains rendered images.
  2. in your terminal (with activated virtual environment) just run
    ffmpeg -framerate '60' -i './animation_visualization/img/%05d.png' ./animation_visualization/video.mp4
    This should encode the images to a video (ignoring audio for now). Does this work?

from voca.

Wentao795 avatar Wentao795 commented on May 16, 2024

verg nice,it worked.!!!haha, how add audio ?

from voca.

Wentao795 avatar Wentao795 commented on May 16, 2024

i try to add audio.but have bug!!!
The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.

##The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.

from voca.

TimoBolkart avatar TimoBolkart commented on May 16, 2024

Please try to run following in you terminal
ffmpeg -framerate '60' -i './animation_visualization/img/%05d.png' -i ./audio/test_sentence.wav ./animation_visualization/video.mp4
with the /audio/test_sentence.wav replaced by the audio file you used to run VOCA. Does this also work?

from voca.

yefeng1992 avatar yefeng1992 commented on May 16, 2024

@ TimoBolkart :
Please try to run following in you terminal
ffmpeg -framerate '60' -i './animation_visualization/img/%05d.png' -i ./audio/test_sentence.wav ./animation_visualization/video.mp4
with the /audio/test_sentence.wav replaced by the audio file you used to run VOCA. Does this also work?


the same problem

from voca.

TimoBolkart avatar TimoBolkart commented on May 16, 2024

I played a bit with ffmpeg and was unable to reproduce this error. You could try to convert the audio to another file format before encoding the video, or try to use a different audio sequence. The problems seems related to ffmepg not to the VOCA part, hence it is difficult for me to help there

from voca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.