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.

write_videofile does not add audio

See original GitHub issue

I encounter a problem on Amazon Linux.

I have a code which generates composite videos. On ubuntu 18.04 is working file, on Amazon Linux the audio is not embedded in the video. The temporary audio file contains the proper audio. I’ve tried to specify the codecs or not, it’s not working.

CODE:

write_videofile(self.v3_name,
                                            write_logfile=True,
                                            threads=8,
                                            preset='ultrafast',
                                            temp_audiofile='temp-audio.mp3',
                                            rewrite_audio=True,
                                            audio=True,
                                            remove_temp=False)

Here are the logs: AUDIO: ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/ Copyright © 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, s32le, from ‘pipe:’: Duration: N/A, bitrate: 2822 kb/s Stream #0:0: Audio: pcm_s32le, 44100 Hz, stereo, s32, 2822 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_s32le (native) -> mp3 (libmp3lame)) Output #0, mp3, to ‘temp-audio.mp3’: Metadata: TSSE : Lavf58.29.100 Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s32p Metadata: encoder : Lavc58.54.100 libmp3lame size= 1790kB time=00:01:54.54 bitrate= 128.0kbits/s speed= 37x
video:0kB audio:1790kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.013801%

VIDEO: ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/ Copyright © 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, rawvideo, from ‘pipe:’: Duration: N/A, start: 0.000000, bitrate: 870912 kb/s Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1600x756, 870912 kb/s, 30 tbr, 30 tbn, 30 tbc Input #1, mp3, from ‘temp-audio.mp3’: Metadata: encoder : Lavf58.29.100 Duration: 00:01:54.57, start: 0.025057, bitrate: 128 kb/s Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc58.54 Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) [libx264 @ 0x555556724e40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x555556724e40] profile Constrained Baseline, level 3.2, 4:2:0, 8-bit [libx264 @ 0x555556724e40] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=8 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0 Output #0, mp4, to ‘./tmp/Client1-1572570980.295778/v3s/Rubin Guttman & Associates.mp4’: Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1600x756, q=-1–1, 30 fps, 15360 tbn, 30 tbc Metadata: encoder : Lavc58.54.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 frame= 3436 fps= 33 q=-1.0 Lsize= 28309kB time=00:01:54.50 bitrate=2025.4kbits/s speed=1.11x
video:28294kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.051786% [libx264 @ 0x555556724e40] frame I:14 Avg QP:12.43 size:269914 [libx264 @ 0x555556724e40] frame P:3422 Avg QP:15.16 size: 7362 [libx264 @ 0x555556724e40] mb I I16…4: 100.0% 0.0% 0.0% [libx264 @ 0x555556724e40] mb P I16…4: 1.1% 0.0% 0.0% P16…4: 8.0% 0.0% 0.0% 0.0% 0.0% skip:90.9% [libx264 @ 0x555556724e40] coded y,uvDC,uvAC intra: 34.9% 41.2% 34.6% inter: 3.7% 3.9% 2.1% [libx264 @ 0x555556724e40] i16 v,h,dc,p: 54% 38% 4% 3% [libx264 @ 0x555556724e40] i8c dc,h,v,p: 43% 36% 18% 3% [libx264 @ 0x555556724e40] kb/s:2023.69

  • Python Version: 3.6
  • Moviepy Version: 1.0.1
  • Platform Name: Amazon Linux
  • Platform Version:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

5reactions
ghostcommented, Nov 3, 2019

I faced this issue as well on a project I’m currently working on and it seems like many people are facing this issue as well. For some people, by changing the audio encoding that did the trick and fixed the issue (such as #820). However, changing the audio encoding didn’t work for me, the only solution I found for this issue is one mentioned in #876 was to remove the -an from the ffmpeg_writer.py file in \site-packages\moviepy-1.0.1-py3.7.egg\moviepy\video\io

After I removed the -an from there it all worked like a charm.

0reactions
tburrows13commented, Mar 9, 2020

Should be fixed in #968. Feel free to reopen if not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No audio when adding Mp3 to VideoFileClip MoviePy
I solved this through a workaround using ffmpeg directly. It uses the temp audio file and video file from moviepy to create a...
Read more >
No Sound : r/moviepy - Reddit
So I'm working with a very simple project, and I'm getting no sound. There's no audio track whatsoever on the output.
Read more >
AudioClip — MoviePy 1.0.2 documentation
An AudioClip is a Clip with a make_frame attribute of the form `` t -> [ f_t ]`` for mono sound and t->...
Read more >
AudioClip - MoviePy documentation - Read the Docs
These bounds can be trespassed without problems (the program will put the sound back into ... The frame does not mean much for...
Read more >
How to use the moviepy.editor.AudioFileClip function in ... - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... 'audio': # cast clips to...
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