-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Segmentation fault when running examples/save_videos.rb #46
Comments
@fapdash According to the official website, the following dependent libraries are required to build GR. https://gr-framework.org/building.html The libraries related to video output are depends_on "cmake" => :build
depends_on "cairo"
depends_on "glfw"
depends_on "libtiff"
depends_on "qhull"
depends_on "qt@5"
depends_on "zeromq" I guess Linux can't output video for the same reason... |
Parhaps, you may be able to output video by simply installing the following dependent libraries. Libraries that may be related to video output are: sudo apt install -y libavcodec-dev \
libavdevice-dev \
libavformat-dev \
libavutil-dev |
What is your distribution? |
I'm on Ubuntu 20.04 as well. The same error still happens after installing the packages mentioned in #46 (comment). |
What about libavdevice-dev? |
Mh, that's also already installed: |
I confirmed that the same error occurs when I set GKS_WSTYPE=100. |
There are 2 problems:
diff --git a/lib/gks/plugin/vc.c b/lib/gks/plugin/vc.c
index 6391d651..ccf76cf0 100644
--- a/lib/gks/plugin/vc.c
+++ b/lib/gks/plugin/vc.c
@@ -270,7 +270,10 @@ void vc_movie_finish(movie_t movie)
if (movie->fmt_ctx && movie->cdc_ctx)
{
- av_write_trailer(movie->fmt_ctx);
+ if (movie->fmt_ctx->pb)
+ {
+ av_write_trailer(movie->fmt_ctx);
+ }
avcodec_close(movie->cdc_ctx);
if (!(movie->out_fmt->flags & AVFMT_NOFILE)) For example, It can be happen by specifying wrong video size (
diff --git a/examples/save_videos.rb b/examples/save_videos.rb
index d17dbc1..68bf6a3 100644
--- a/examples/save_videos.rb
+++ b/examples/save_videos.rb
@@ -21,6 +21,9 @@ epoch.times do |i|
y << i**2 * Math.cos(i * Math::PI / 10.0) / 100.0
end
+# configure video size
+ENV['GKS_VIDEO_OPTS'] = '360x240@25@2x'
+
# start
GR.beginprint('savefig/video.mov')
@@ -32,9 +35,6 @@ end
# stop
GR.endprint
-# configure video size
-ENV['GKS_VIDEO_OPTS'] = '360x240@25@2x'
-
# You can use block
GR.beginprint('savefig/video.mp4') do
epoch.times do |j| If it's not specified, width and height ( It may set invalid width and/or height (not mod 4). Could you report 1. to GR? |
@kou |
Oh, sorry. It's abbreviation of "modulo 4": |
x264 that is used by ffmpeg requires "mod 4" in this case: https://code.videolan.org/videolan/x264/-/blob/master/encoder/encoder.c#L529 |
Thank you. |
Reported to sciapp/gr. |
I understand that the README says that video might not be supported by the versions provided by package managers but a more helpful error message in those cases would be nice.
I followed the instructions to install
libgrm-dev
through apt:And then tried to run the
save_videos.rb
example:The text was updated successfully, but these errors were encountered: