question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with writing audio

See original GitHub issue

Hey there. I’m experiencing a problem when writing audio. If I call .to_videofile with audio=False, then there is no problem. My videopy version number is 0.2.1.8.02.

The video I’m working with is here: https://www.dropbox.com/s/iepmbyieferjbay/test.MP4

The code is here:

clip = mp.VideoFileClip('../snowsports/test.MP4').subclip(220,224)
clip.to_videofile("test-short.MP4")

There error message is:

MoviePy: building video file test-short.MP4
----------------------------------------
Writing audio in test-shortTEMP_MPY_to_videofile_SOUND.ogg
Done writing Audio in test-shortTEMP_MPY_to_videofile_SOUND.ogg !

Writing video into test-shortTEMP_MPY_to_videofile.MP4
Done writing video in test-shortTEMP_MPY_to_videofile.MP4 !

Now merging video and audio:

MoviePy Running:
>>> ffmpeg -y -i test-shortTEMP_MPY_to_videofile_SOUND.ogg -i test-shortTEMP_MPY_to_videofile.MP4 -vcodec copy -acodec copy test-short.MP4
MoviePy: WARNING !
   The following command returned an error:
ffmpeg version 2.2.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 06:47:04 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libavresample   1.  2.  0 /  1.  2.  0
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
test-shortTEMP_MPY_to_videofile_SOUND.ogg: No such file or directory
Conversion failed!
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-13-b6f4d3578283> in <module>()
      1 clip = mp.VideoFileClip('../snowsports/test.MP4').subclip(220,224)
----> 2 clip.to_videofile("test-short.MP4")

/usr/local/lib/python2.7/site-packages/moviepy/video/VideoClip.pyc in to_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, para, verbose)
    286             verbose_print("\n\nNow merging video and audio:\n")
    287             ffmpeg_merge_video_audio(videofile,temp_audiofile,
--> 288                                   filename, ffmpeg_output=True)
    289 
    290             if remove_temp:

/usr/local/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_tools.pyc in ffmpeg_merge_video_audio(video, audio, output, vcodec, acodec, ffmpeg_output, verbose)
     49              "-vcodec", vcodec, "-acodec", acodec, output]
     50 
---> 51     subprocess_call(cmd, verbose = verbose)
     52 
     53 

/usr/local/lib/python2.7/site-packages/moviepy/tools.pyc in subprocess_call(cmd, verbose, errorprint)
     33                     "   The following command returned an error:\n")
     34             sys_write_flush( err.decode('utf8'))
---> 35         raise IOError
     36     else:
     37         verboseprint( "\n... command successful.\n")

IOError: 

I’ve also tried explicitly specifying the codec as ‘mpeg4’. I’m not sure if that makes any difference, but the result is the same.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

50reactions
jaribcommented, Mar 9, 2015

This worked for me to get the file to play in Quicktime/iMovie:

clip.write_videofile(out_path, 
  codec='libx264', 
  audio_codec='aac', 
  temp_audiofile='temp-audio.m4a', 
  remove_temp=True
)
1reaction
Zulkocommented, Jun 25, 2014

On the videogrep page they say to install ffmpeg with

brew install ffmpeg --with-libvpx --with-libvorbis

But you should give up with libvorbis and try to understand why it doesn’t even work with mp3, that would be simpler. You said there is no sound: with what software are you playing it ? Could you try playing it with VLC and see if there is still no sound ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Dysgraphia? - DSF
Dysgraphia is characterised by the person having difficulty converting the sounds of language into written form (phonemes into graphemes), or knowing which ...
Read more >
Audition has encountered an error reading or writi... - 9484743
The problem starts when Audition freeze for a very long time, and I can not do anything with in the program. Then I...
Read more >
Misunderstood Minds . Writing Difficulties - PBS
An attention problem may manifest itself as: difficulty getting started on writing assignments; easy distractibility during writing tasks; mental fatigue or ...
Read more >
Fixing Problems With Speech - TextHelp Support
Open Control Panel > “Sounds, Speech and Audio Devices”> “Speech”. The panel does not appear. Try Cure Number 2 first. If it does...
Read more >
Troubleshoot audio and video issues on your computer or ...
Windows: See Fix sound problems in Windows 10 . Note: Running the audio troubleshooter may help resolve your issue, but it requires ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found