【问题标题】:Manim error: It's a sound problem that I haven't seen anywhere elseManim 错误:这是我在其他任何地方都没有见过的声音问题
【发布时间】:2021-03-08 03:55:23
【问题描述】:

我已经使用 Manim 大约一个月了,由于已经存在阻碍我进步的障碍,当我到达 this part of Theorem of Beethoven's tutorial 时,没有什么比没有声音更痛苦的了。我已经为此苦苦挣扎了三周,并在 GitHub 和 Reddit 上打开了问题,但没有任何成功。

所以代码看起来像这样:

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",gain=-10)
            self.add(dot)
            self.wait()
            self.wait()

而且错误消息有点长,我仍在破解它的实际含义。这里是:\

C:\Manim\manim-18june>python manim.py tutorial\7_add_audio.py AudioTest -pm
Media will be written to C:/Users/Allan Muruha.Wanjeri-PC.000/Videos/manim_videos\. You can change this behavior with the --media_dir flag.


Traceback (most recent call last):
  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

Command:['ffmpeg', '-y', '-f', 'wav', '-i', 'C:\\Users\\ALLANM~1.000\\AppData\\Local\\Temp\\tmpk6j8yj98', '-b:a', '312k', '-f', 'mp3', 'C:\\Users\\ALLANM~1.000\\AppData\\Local\\Temp\\tmpyn225uxk']

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\tmpk6j8yj98':
  Duration: 00:00:04.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 @ 011be000] could not find any MFT for the given media type
[mp3_mf @ 011be000] 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 do have a larger documentation of the problem with current progress [over at GitHub](https://github.com/3b1b/manim/issues/1152)

>Help
>>Me
>>>Please :(
>>>>Pardon my naive looking formatting, I'm new to Markdown

【问题讨论】:

    标签: ffmpeg manim


    【解决方案1】:

    我想,已经很晚了,不过来了。

    截至此时更新到最新版本的 manim 社区 Manim Community v0.4.0

    只需使用self.add_sound(filename, gain)

    最新版本实现了add_sound方法。

    【讨论】:

      【解决方案2】:

      添加-c:a libmp3lame 输出选项

      您的ffmpeg 版本会自动选择名为mp3_mf 的MP3 编码器,即MediaFoundation MP3 编码器,但这个编码器是too picky

      也许 mp3_mf 自从提出这些问题后有所改进,所以如果你真的想使用 mp3_mf 然后从 git master 分支更新你的ffmpeg

      【讨论】:

        猜你喜欢
        • 2018-11-05
        • 2017-08-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-17
        • 2019-09-28
        • 2012-12-01
        • 2013-04-26
        相关资源
        最近更新 更多