Sound in Windows refuses to be rendered due to FFMPEG error #1152
Comments
FFMPEG is a converter application that converts from audio and video formats to other audio and video formats, it is what generates the output videos for this application (which just feeds it essentially series of pictures to use as frames). That error seems to imply that it's trying to read a file but the file is an invalid format or is empty, like maybe a background mp3 audio file? |
But what do you think of the error at the pydub line? I know if the file destination was incorrect I would've just gotten that notification. This is something else entirely. And I guarantee you, those other random files are not mp3 files. |
Can you condense the project with the issue into a minimal example that we can clone and try running to replicate the issue? |
Sure. It's a simple Manim code that tests out a particular audio.
As you can tell by the name of the file I was quite frustrated. The audio exists in the assets folder for Manin at sounds. I renamed the audio file present there Thank you so much for caring :) |
I'm new to manim but it's pretty interesting, so a good way for me to learn some less-code-related parts of it is to look at some issues and see what I can figure out. ^.^ I'm curious how the blocks are in the code? Is this correct? class AudioTest(Scene):
def construct(self):
group_dots=VGroup(*[Dot()for _ in range(3)])
group_dots.arrange_submobjects(RIGHT)
for dot in group_dots:
self.add_sound("click_this_and_nothing_else.wav",gain=-10)
self.add(dot)
self.wait()
self.wait() It was first autoformatted to this but this didn't seem like what was intended I'd think? class AudioTest(Scene):
def construct(self):
group_dots=VGroup(*[Dot()for _ in range(3)])
group_dots.arrange_submobjects(RIGHT)
for dot in group_dots:
self.add_sound("click_this_and_nothing_else.wav",gain=-10)
self.add(dot)
self.wait()
self.wait() For note, if you use code fences in github it will keep formatting, like this:
Which will render like:
:-) |
I ran the first version of the code above and it generated this file successfully: https://overminddl1.com/tmp/AudioTest.mp4 All I did was copy it into a file named
So I then uploaded that file at the above link. :-) So this seems to imply something wrong with your setup. Googling your error messages... It looks like that's an issue on windows when missing the media foundation windows libraries on windows 10 or windows server 2016, I'm guessing you have one of those? Open an admin powershell window and run
Please report back on all this, but it definitely seems like something windows specific and I haven't ran windows in well over a decade so I personally may not be more help beyond this point any more than google... ^.^; But at least your code seems good and it works here. :-) |
Thank you for the formatting information kind sir |
Installing that Windows feature I haven't yet succeeded at. Is that the only command I should run or should I acquire something extra from the Internet? In addition all I'm lacking is this file: C:\Windows\System32\CompPkgSup.dll I am a Windows 7 user, sadly. Thanks for the assist. I think if I can work my way around that installation I'll have this problem in the bag. The autocorrected formatting you got should work, but the original code was shown to work in the video. |
Ah yeah that command doesn't work on Win7 from what I read, only Win10 and Win2016, I didn't see anything about Win7 when I was googling it. Hmm... As a test, are you able to convert the wav to an mp3 using ffmpeg? Just trying Where did you get ffmpeg? I can try grabbing it as well and run it in wine to see if I can replicate the issue. |
FFMPEG I got from as I usually do, the free and completely safe web. Here she is. I acquired my Windows version there but for the general case head here to get the one that works for you. Do I need to specify that file location for the FFMPEG conversion? Ah well, I'll try them both ways Thanks a lot for your help. |
And...nope! C:\Manim\manim-18june>ffmpeg -i assets\sounds\click_this_and_nothing_else.wav click_this_and_nothing_else.mp3 |
Yeah you definitely found the issue, that's a broken ffmpeg, but that might be because it can't find the mp3 compressor on your system rather than any issue within itself. I can't really test any possible fixes to see if they help but googling for things like |
I'm curious, what version of Windows 7? It's not the home edition I hope? I've heard lots of issues about that one missing various functionality. |
I think it's the 64 bit version. My little knowledge of computers in general limits me to that answer |
I'm working on it myself as well. I know I've oversaid this but thank you |
Keep us updated! If someone else runs into the same issue then such a fix that you find would be very useful! :-) |
Two weeks later. I took the advice of the error message and tried ffmpeg on other kinds of videos and audios. It can convert all the videos I've produced so far in Manim with whatever quality and a few audio files. I think that my best bet is if I can modify scenes in the manimlib folder to accomodate the frame rate and stuff. Also, it appears not to accept the short audio file from before but smoothly converts a whole Breaking Benjamin song without breaking a sweat. Maybe that's the core problem. It may just be hating on .wav files. As shown:
Basically success! Now see what the other way around looks like:
Interesting. Still working on it though, hope I succeed |
Hah, love the followup! ^.^
Hmm, so just processing that short little audio clip is failing for you with ffmpeg straight?! What's the error or what do it do? |
I still don't know exactly how to deal with this. The nature of audio files is still foreign to me. What I do think is I could perhaps change the scene_file_writer.py file to accomodate these files with specific bit rates and widths and heights. And now I feel compelled to ask: remember this part in my error code:
When you ran the program from Manim did the command look like this or better? I think there's something about that .py file that directs FFMPEG to that odd file location. Maybe I could also check on that. |
The command is similar to that yeah, it processes in a temp location. |
Interesting. I thought that was a problem with how it was running. |
I took a bit of advice you kind of alluded to from the start. Out of necessity I have to migrate to another laptop for a week. Installed Manim on this laptop (Windows 10, 32 bit etc) and here the audio works like a charm. I could almost cry. Almost. ALMOST! So in a week I may shift to previous laptop and keep up the good work of generating error messages but as of now my problem is 30% solved! I should've done this ages ago :( |
same error. mp3 can convert to wav, wav cannot convert to mp3 |
windows7 |
NeoPlato commentedon Jun 30, 2020
•
edited
I tried to play the sound files as instructed by Theorem Of Beethoven yet a strange kind of error is produced specifically from FFMPEG that I don't completely understand but still is annoying.
Pardon my lack of good formatting.
File "C:\Manim\manim-18june\manimlib\extract_scene.py", line 155, in main
scene = SceneClass(**scene_kwargs)
File "C:\Manim\manim-18june\manimlib\scene\scene.py", line 79, in init
self.file_writer.finish()
File "C:\Manim\manim-18june\manimlib\scene\scene_file_writer.py", line 379, in finish
self.combine_movie_files()
File "C:\Manim\manim-18june\manimlib\scene\scene_file_writer.py", line 506, in combine_movie_files
self.audio_segment.export(
File "C:\Users\Allan Muruha.Wanjeri-PC.000\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pydub\audio_segment.py", line 911, in export
raise CouldntEncodeError(
pydub.exceptions.CouldntEncodeError: Encoding failed. ffmpeg/avlib returned error code: 1
And then after that the program is generous enough to proceed with this:
Command:['ffmpeg', '-y', '-f', 'wav', '-i', 'C:\Users\ALLANM
1.000\AppData\Local\Temp\tmpz415eeyi', '-b:a', '312k', '-f', 'mp3', 'C:\Users\ALLANM1.000\AppData\Local\Temp\tmpjzli2wu2']Output from ffmpeg/avlib:
ffmpeg version git-2020-06-17-0b3bd00 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --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-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
--enable-amf
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 92.100 / 58. 92.100
libavformat 58. 46.101 / 58. 46.101
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'C:\Users\ALLANM~1.000\AppData\Local\Temp\tmpz415eeyi':
Duration: 00:00:02.23, bitrate: 2822 kb/s
Stream #0:0: Audio: pcm_s32le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s32, 2822 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s32le (native) -> mp3 (mp3_mf))
Press [q] to stop, [?] for help
[mp3_mf @ 06a9dec0] could not find any MFT for the given media type
[mp3_mf @ 06a9dec0] could not create MFT
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
Conversion failed!
I really don't understand Manim and Python that well right now so this is just a good source for pure stress
I tried looking into the problem on my own but that aspect is from the FFMPEG side and I'm still not entirely sure what that program does. I also did intensive web searches for anyone with a similar problem but no dice.
By the way, I installed the latest version of Manim. Should I change and lose a good part of my current progress or is this fixable on the current version?