Skip to content
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

Trying to render just results in a blank file. #63

Closed
locallycompact opened this issue Mar 22, 2020 · 27 comments
Closed

Trying to render just results in a blank file. #63

locallycompact opened this issue Mar 22, 2020 · 27 comments

Comments

@locallycompact
Copy link

Hi, I'm trying to get reanimate working under a nix shell, running the following command just seems to produce a blank mp4 file

runhaskell doc_drawBox.hs render --format mp4

My check looks like

[nix-shell:~/reanimate/examples]$ runhaskell doc_drawBox.hs check
reanimate checks:
  Has ffmpeg:                        4.2.2
  Has LaTeX:                         'latex'' not found
  Has XeLaTeX:                       'xelatex'' not found
  Has dvisvgm:                       'dvisvgm'' not found
  Has povray:                        'povray'' not found
  Has LaTeX package 'babel':         n/a
  Has LaTeX package 'preview':       n/a
  Has LaTeX package 'amsmath':       n/a
  Has LaTeX package 'amssymb':       n/a
  Has LaTeX package 'dsfont':        n/a
  Has LaTeX package 'setspace':      n/a
  Has LaTeX package 'relsize':       n/a
  Has LaTeX package 'textcomp':      n/a
  Has LaTeX package 'mathrsfs':      n/a
  Has LaTeX package 'calligra':      n/a
  Has LaTeX package 'wasysym':       n/a
  Has LaTeX package 'ragged2e':      n/a
  Has LaTeX package 'physics':       n/a
  Has LaTeX package 'xcolor':        n/a
  Has LaTeX package 'textcomp':      n/a
  Has LaTeX package 'xfrac':         n/a
  Has LaTeX package 'microtype':     n/a
  Has XeLaTeX package 'ctex':        n/a
@lemmih
Copy link
Member

lemmih commented Mar 23, 2020

Do you mean that the size of the mp4 file is zero or that it generates a video but each frame is black/white?

@lemmih
Copy link
Member

lemmih commented Mar 23, 2020

And what's the output of 'ffmpeg -version'? Maybe it was compiled without --enable-librsvg.

@locallycompact
Copy link
Author

As in zero size. Here's ffmpeg -version

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.0 (GCC)
configuration: --disable-static --prefix=/nix/store/s9gj51zibwxylbg0l96m4rfqbsh9mlja-ffmpeg-4.2.2 --arch=x86_64 --target_os=linux --enable-gpl --enable-version3 --enable-shared --enable-pic --enable-runtime-cpudetect --enable-hardcoded-tables --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --enable-ffmpeg --disable-ffplay --enable-ffprobe --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --disable-doc --enable-bzlib --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libmp3lame --enable-iconv --enable-libtheora --enable-libssh --enable-vaapi --enable-libdrm --enable-vdpau --enable-libvorbis --enable-libvpx --enable-lzma --disable-opengl --disable-libmfx --disable-libaom --enable-libpulse --enable-sdl2 --enable-libsoxr --enable-libx264 --enable-libxvid --enable-zlib --enable-libopus --enable-libspeex --enable-libx265 --enable-libdav1d --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
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
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

@locallycompact
Copy link
Author

locallycompact commented Mar 23, 2020

Similarly empty with --format webm, and with --format gif it does not make a file at all.

@lemmih
Copy link
Member

lemmih commented Mar 23, 2020

Yeah, it looks like your ffmpeg doesn't have svg support. I would have imagined it to throw an error in that case, though. What text output do you see when rendering an animation?
You can use an external rasterizer to convert the SVG images to PNG files. Reanimates supports inkscape, rsvg and imagemagick. See the --raster flag for the render command.

@locallycompact
Copy link
Author

[nix-shell:~/reanimate/examples]$ runhaskell doc_drawBox.hs render --format mp4
Animation options:
  fps:    60
  width:  2560
  height: 1440
  fmt:    mp4
  target: /home/lc/reanimate/examples/doc_drawBox.mp4
Starting render of animation: 2.0
120/120

@lemmih
Copy link
Member

lemmih commented Mar 23, 2020

That is quite strange. Apparently ffmpeg silently ignores SVGs if it wasn't compiled with --enable-librsvg. I'll have to add a check for this.

@locallycompact
Copy link
Author

Hmm it would seem there's also an ffmpeg-full in nixkpgs, but this too doesn't seem to have libsvg included.

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/ffmpeg-full/default.nix

@locallycompact
Copy link
Author

Sorry, it turned out I was using an old version of reanimate, this is with the latest.

[nix-shell:~/reanimate/examples]$ runhaskell doc_drawBox.hs render --format mp4
Animation options:
  fps:    60
  width:  2560
  height: 1440
  fmt:    mp4
  target: /home/lc/reanimate/examples/doc_drawBox.mp4
Starting render of animation: 2.0
120/120

doc_drawBox.hs: /nix/store/5kk09z63c6dc5jrm6ygspmq9c90pdw29-ffmpeg-full-4.2.2/bin/ffmpeg -r 60 -i '/run/user/1000/reanimate89676-0/render-%05d.svg' -y '-c:v' libx264 -vf 'fps=60' -preset slow -crf 18 -movflags '+faststart' -progress /run/user/1000/reanimate89676-1.txt -pix_fmt yuv420p /home/lc/reanimate/examples/doc_drawBox.mp4:
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.0 (GCC)
  configuration: --disable-static --prefix=/nix/store/5kk09z63c6dc5jrm6ygspmq9c90pdw29-ffmpeg-full-4.2.2 --target_os=linux --arch=x86_64 --enable-gpl --enable-version3 --disable-nonfree --enable-shared --enable-pic --disable-small --enable-runtime-cpudetect --disable-lto --enable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --enable-doc --disable-htmlpages --enable-manpages --disable-podpages --disable-txtpages --enable-bzlib --enable-libcelt --enable-libdav1d --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-ladspa --enable-libmp3lame --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdc1394 --enable-iconv --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmysofa --enable-libopus --enable-libssh --enable-libtheora --enable-libv4l2 --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvmaf --enable-libvpx --enable-libwebp --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-lzma --enable-nvenc --enable-openal --enable-libopencore-amrnb --disable-opengl --enable-libopenjpeg --disable-openssl --enable-libpulse --enable-librtmp --enable-sdl2 --enable-libsoxr --enable-libspeex --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-zlib --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[image2 @ 0x1c37f40] Could not find codec parameters for stream 0 (Video: svg, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, image2, from '/run/user/1000/reanimate89676-0/render-%05d.svg':
  Duration: 00:00:04.80, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: svg, none, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (? (?) -> h264 (libx264))
Decoder (codec svg) not found for input stream #0:0

CallStack (from HasCallStack):
  error, called at src/Reanimate/Misc.hs:33:17 in reanimate-0.2.0.2-DbGYvOMK5eG2wV5gvNF4DQ:Reanimate.Misc

@lemmih
Copy link
Member

lemmih commented Mar 23, 2020

Will using either inkscape, rsvg or imagemagick (convert) work for you?

@locallycompact
Copy link
Author

Yes, I managed to get the drawBox example working using --raster convert. So far so good.

I'm having trouble with the blender examples though as below: Maybe I'll open another issue for this.

[nix-shell:~/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations]$ runhaskell tut_glue_blender.hs render
Animation options:
  fps:    60
  width:  2560
  height: 1440
  fmt:    mp4
  target: /home/lc/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations/tut_glue_blender.mp4
Starting render of animation: 60.0
0/3600tut_glue_blender.hs: /run/user/1000/-78348659261649607235792-1.png: renameFile:renamePath:rename: unsupported operation (Invalid cross-device link)

@lemmih
Copy link
Member

lemmih commented Mar 24, 2020

I pushed a fix for the issue with 'renameFile'. Let me know if it works for you.

@locallycompact
Copy link
Author

I'm having trouble testing this because haskell.nix apparently doesn't like brining stack extra-deps into the shell, but I'll get back to you.

@locallycompact
Copy link
Author

locallycompact commented Mar 24, 2020

Yes, thank you very much this seems to work.

@locallycompact
Copy link
Author

I have one last problem in that exporting latex_draw.hs to a gif seems to give the following error, but exporting tut_glue_blender.hs to a gif seems to work fine.

[nix-shell:~/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io]$ runhaskell site/animations/latex_draw.hs  render --preset quick --raster convert --format gif
Animation options:
  fps:    15
  width:  320
  height: 180
  fmt:    gif
  target: /home/lc/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations/latex_draw.gif
  raster: RasterConvert
Starting render of animation: 6.0
Frames rendered: 90/90, time spent: 3s
latex_draw.hs: /nix/store/5kk09z63c6dc5jrm6ygspmq9c90pdw29-ffmpeg-full-4.2.2/bin/ffmpeg -framerate 15 -i '/run/user/1000/reanimate14774-0/render-%05d.png' -y -i /run/user/1000/reanimate14774-2.png -progress /run/user/1000/reanimate14774-1.txt -filter_complex 'fps=15,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse' -t 6.0 /home/lc/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations/latex_draw.gif:
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.0 (GCC)
  configuration: --disable-static --prefix=/nix/store/5kk09z63c6dc5jrm6ygspmq9c90pdw29-ffmpeg-full-4.2.2 --target_os=linux --arch=x86_64 --enable-gpl --enable-version3 --disable-nonfree --enable-shared --enable-pic --disable-small --enable-runtime-cpudetect --disable-lto --enable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --enable-doc --disable-htmlpages --enable-manpages --disable-podpages --disable-txtpages --enable-bzlib --enable-libcelt --enable-libdav1d --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-ladspa --enable-libmp3lame --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdc1394 --enable-iconv --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmysofa --enable-libopus --enable-libssh --enable-libtheora --enable-libv4l2 --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvmaf --enable-libvpx --enable-libwebp --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-lzma --enable-nvenc --enable-openal --enable-libopencore-amrnb --disable-opengl --enable-libopenjpeg --disable-openssl --enable-libpulse --enable-librtmp --enable-sdl2 --enable-libsoxr --enable-libspeex --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-zlib --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, image2, from '/run/user/1000/reanimate14774-0/render-%05d.png':
  Duration: 00:00:06.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, monob(pc), 320x180 [SAR 96:96 DAR 16:9], 15 fps, 15 tbr, 15 tbn, 15 tbc
Input #1, png_pipe, from '/run/user/1000/reanimate14774-2.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (png) -> fps
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
[image2 @ 0x886fc0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, gif, to '/home/lc/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations/latex_draw.gif':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: gif, pal8, 320x180 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 15 fps, 100 tbn, 15 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 gif
Error marking filters as finished
Conversion failed!

CallStack (from HasCallStack):
  error, called at src/Reanimate/Misc.hs:38:17 in reanimate-0.2.0.2-DbGYvOMK5eG2wV5gvNF4DQ:Reanimate.Misc

@locallycompact
Copy link
Author

locallycompact commented Mar 24, 2020

Spoke too soon, one more issue.

This doesn't seem to be able to run headless in CI, here: https://gitlab.com/shakebook-site/shakebook-site.gitlab.io/-/jobs/484192100

Edit: Looks like this is because eevee can't run without an active opengl context, switching to cycles will run headless but is much slower.

@lemmih
Copy link
Member

lemmih commented Mar 25, 2020

With a threadripper 1950x, it might be doable in a reasonable amount of time. Use the --compile flag to render concurrently using all available cores. Without that flag, it'll only use a single core.

@lemmih
Copy link
Member

lemmih commented Mar 25, 2020

What's your usecase, btw? Why are you rendering blender graphics in a headless environment?

@locallycompact
Copy link
Author

Ah great, I'll try that.

This is my use case, see the docs page and gitlab for the general idea. :) Would be nice to get gif output working at least.

https://shakebook.site/

@locallycompact
Copy link
Author

Ah running --compile doesn't play well inside the nix shell apparently.

[nix-shell:~/Source/gitlab.com/shakebook-site/shakebook-site.gitlab.io/site/animations]$ runhaskell tut_glue_blender.hs  render --preset quick --raster convert --format mp4 --compile
Cloning 8c7f4f34b75c1c410ce4b951b4410ae9a2b26031 from https://github.com/Lemmih/reanimate
I don't know how to install GHC on your system configuration, please install manually

@lemmih
Copy link
Member

lemmih commented Mar 25, 2020

Ah, right, it tries to use 'stack' to compile itself. You can do it manually, though. Compile tut_glue_blender and execute it manually with the same 'render --preset quick --raster convert --format mp4' arguments.

@locallycompact
Copy link
Author

Ah ok, that speeds it up a little bit with cycles. Is there a way to enable the GPU? How do I tell if it's using the GPU

@lemmih
Copy link
Member

lemmih commented Mar 25, 2020

There is a way to let cycles use the GPU but I'm not sure how. If you can't use Eevee then it might not be possible to access the GPU. If you can figure out how to do it using the Blender GUI then converting it to a script is easy.

Oh, I forgot to say that you should run tut_glue_blender with +RTS -N -RTS. Also, compile it with -threaded and -rtsopts.

@lemmih
Copy link
Member

lemmih commented May 13, 2020

Everything seems to be resolved. Closing issue.

@lemmih lemmih closed this as completed May 13, 2020
@commandodev
Copy link
Contributor

@locallycompact I'm also trying to get up and running with nix. I couldn't find your fork, could you share your nix setup?

@commandodev
Copy link
Contributor

See #140 ^^

@locallycompact
Copy link
Author

@commandodev I have reanimate in a shell over at https://gitlab.com/shakebook-site/shakebook-site.gitlab.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants