-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write_videofile does not add audio #1032
Comments
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 After I removed the |
Try specifying as audio='temp-audio.mp3' and removing the temp_audiofile option. See my test here: /~https://github.com/Zulko/moviepy/pull/1037/files#diff-488857f543e242a02c35d5b0b73668eaR208 Please let me know if that fixes your problem. If not, please output the ffmpeg command line generated so I can write a test to cover your case To get the command logged to your console (until it is merged) you can pip install /~https://github.com/thenewguy/moviepy/archive/log-ffmpeg-command.zip#egg=moviepy |
@THConer if possible, please review my test cases. If they do not cover your case, please let me know the difference so I can update them. |
hello,the example is working,but how can i subclip the audio clip? |
I have no audio also. This is the command before it was writing the audio and then writing the video, now it's writing the video directly ------------------------------------------- edit ----------------------------------------
the new edited code which has sound
|
Should be fixed in #968. Feel free to reopen if not. |
This applies to moviepy Version: 2.1.1 Problem: No audio in final video after adding a mp3 sound file. Seems to be a problem in line 123 in ffmpeg_writer.py: if audiofile is not None: Behaviour: -acodec is hard coded to "copy". That works fine if the input file is m4a-format (mandatory in a mp4 video), but not if the input is mp3 or other, the mp3 file is copied into the video, but there is no sound when played. Temporary workaround: Replace "copy" with "aac" in the code line 123 and it will work for mp3 audio files. Cause: The audio_codec param passed in VideoClip.write_videofile() isn't used down the pipeline in ffmpeg_writer.py so there's no way to change the codec, which is needed if the input audio isn't m4a. Hope that helps! |
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:
Here are the logs:
AUDIO:
ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 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 (c) 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
The text was updated successfully, but these errors were encountered: