Closed jiangbo0216 closed 5 years ago
Something seems to be wrong with your version of ffmpeg. Maybe reinstalling will help? It might also be informative to run ffmpeg -y -f rawvideo -s 854x480 -pix_fmt rgba -r 15 -i - -an -loglevel error -vcodec libx264 -pix_fmt yuv420p <your media directory here>/animations/example_scenes/480p15/SquareToCircleTemp.mp4
from the command line, since this is exactly the command manim is attempting to write to when it gets the error.
C:\Users\00lim\Downloads\manim-master\manim-master>python extract_scene.py -p example_scenes.py SquareToCircle
Traceback (most recent call last):
File "extract_scene.py", line 299, in
C:\Users\00lim\Downloads\manim-master\manim-master>
thank you
My envirnoment is py37 on windows 7, the version of ffmpeg is 1.18.0, and I run pip install -r requirements.txt, all is ok. But error occurs when running the example!
C:\Program Files\Git\manim>python extract_scene.py -w example_scenes.py Square
ToCircle
Traceback (most recent call last):
File "extract_scene.py", line 15, in
C:\Program Files\Git\manim>
I had the same problem.
I added a debug print in scene_file_write.py
:
diff --git a/manimlib/scene/scene_file_writer.py b/manimlib/scene/scene_file_writer.py
index a6aaa72..46b4b12 100644
--- a/manimlib/scene/scene_file_writer.py
+++ b/manimlib/scene/scene_file_writer.py
@@ -241,6 +241,7 @@ class SceneFileWriter(object):
command += [STREAMING_PROTOCOL + '://' + STREAMING_IP + ':' + STREAMING_PORT]
else:
command += [temp_file_path]
+ print('### DEBUG', command)
self.writing_process = subprocess.Popen(command, stdin=subprocess.PIPE)
def close_movie_pipe(self):
Then run the tutorial: (and got error 'Unknown encoder 'libx264'')
$ python3 -m manim example_scenes.py SquareToCircle -pl
Media will be stored in media/. You can change this behavior by writing a different directory to media_dir.txt.
/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
return f(*args, **kwds)
### DEBUG ['ffmpeg', '-y', '-f', 'rawvideo', '-s', '854x480', '-pix_fmt', 'rgba', '-r', '15', '-i', '-', '-c:v', 'h264_nvenc', '-an', '-loglevel', 'error', '-vcodec', 'libx264', '-pix_fmt', 'yuv420p', '/Users/orange-22/Documents/1-技术积累/manim/media/videos/example_scenes/480p15/partial_movie_files/SquareToCircle/00000_temp.mp4']
Animation 0: ShowCreationSquare: 0%| | 0/15 [00:00<?, ?it/s]Unknown encoder 'libx264'
Traceback (most recent call last):
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/extract_scene.py", line 153, in main
scene = SceneClass(**scene_kwargs)
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene.py", line 52, in __init__
self.construct()
File "example_scenes.py", line 81, in construct
self.play(ShowCreation(square))
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene.py", line 404, in wrapper
func(self, *args, **kwargs)
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene.py", line 461, in play
self.progress_through_animations(animations)
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene.py", line 437, in progress_through_animations
self.add_frames(self.get_frame())
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene.py", line 538, in add_frames
self.file_writer.write_frame(frame)
File "/Users/orange-22/Documents/1-技术积累/manim/manimlib/scene/scene_file_writer.py", line 171, in write_frame
self.writing_process.stdin.write(frame.tostring())
BrokenPipeError: [Errno 32] Broken pipe
I tried to run the raw command with log level trace and got this:
$ ffmpeg -y -f rawvideo -s 854x480 -pix_fmt rgba -r 15 -c:v h264_nvenc -an -loglevel trace -vcodec libx264 -pix_fmt yuv420p -i - media/videos/example_scenes/480p15/partial_movie_files/SquareToCircle/00000_temp.mp4
ffmpeg version N-81494-ga0a5707 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration:
libavutil 55. 29.100 / 55. 29.100
libavcodec 57. 54.101 / 57. 54.101
libavformat 57. 48.101 / 57. 48.101
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 58.100 / 6. 58.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '854x480'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'rgba'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '15'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_nvenc'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option '-i' ... matched as input file with argument '-'.
Reading option 'media/videos/example_scenes/480p15/partial_movie_files/SquareToCircle/00000_temp.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input file -.
Applying option f (force format) with argument rawvideo.
Applying option s (set frame size (WxH or abbreviation)) with argument 854x480.
Applying option pix_fmt (set pixel format) with argument rgba.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 15.
Applying option c:v (codec name) with argument h264_nvenc.
Applying option an (disable audio) with argument 1.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument libx264.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Successfully parsed a group of options.
Opening an input file: -.
Unknown decoder 'libx264'
My ffmpeg are installed from Homebrew:
$ brew info ffmpeg
ffmpeg: stable 4.1.1 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/4.1.1 (282 files, 58.6MB)
Poured from bottle on 2019-03-20 at 21:56:47
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/ffmpeg.rb
==> Dependencies
Build: nasm ✘, pkg-config ✔, texi2html ✘
Required: aom ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, libsoxr ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rtmpdump ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, tesseract ✔, theora ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔
==> Options
--HEAD
Install HEAD version
I'm not familiar with ffmpeg's arguments and compile options, and could not spot any problems. Is there someone that could help?
My ffmpeg are installed from Homebrew:
$ brew info ffmpeg ffmpeg: stable 4.1.1 (bottled), HEAD Play, record, convert, and stream audio and video https://ffmpeg.org/ /usr/local/Cellar/ffmpeg/4.1.1 (282 files, 58.6MB) Poured from bottle on 2019-03-20 at 21:56:47 From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/ffmpeg.rb ==> Dependencies Build: nasm ✘, pkg-config ✔, texi2html ✘ Required: aom ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, libsoxr ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rtmpdump ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, tesseract ✔, theora ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔ ==> Options --HEAD Install HEAD version
I'm not familiar with ffmpeg's arguments and compile options, and could not spot any problems. Is there someone that could help?
Update:
I abandoned homebrew's FFmpeg and used the MacOS prebuilt binary, which solved the problem.
So I'm guessing the homebrew version of FFmpeg lacks some compile option for codec libx264. Wish there's a way to configure it and rebuild via homebrew. But anyway now I'm happy with the prebuilt one.
Thanks guys.
met a problem at first step, I at first thought this may be the enviroment problem. but I finally cant fix it . and this might not be friendly to newer. what I met as flow:
my enviroment is win10 anaconda --py37 lib I install is
pip install -r requirements.txt