testDecode in ghci causes segfault
ffmpeg-light-0.8.1 installed with cabal
When I do: cd ~/.cabal/packages/hackage.haskell.org/ffmpeg-light/0.8.1/demo runhaskell Main.hs "my_video.mp4"
it exits without messages, no files get generated. If run in ghci testEncode works fine, but when I do testDecode "my_video.mp4" it exits with segmentation fault. The path to file is correct, write premissions are correct.
ffmpeg version 2.3.3 Copyright (c) 2000-2014 the FFmpeg developers built on Nov 14 2014 12:17:00 with gcc 4.8 (SUSE Linux) configuration: --shlibdir=/usr/lib64 --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --disable-static --enable-debug --disable-stripping --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-gpl --enable-x11grab --enable-version3 --enable-pthreads --enable-avfilter --enable-libpulse --enable-libvpx --enable-libopus --enable-libass --enable-libx265 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-postproc --enable-libdc1394 --enable-librtmp --enable-libfreetype --enable-avresample --enable-libtwolame --enable-libvo-aacenc --enable-gnutls libavutil 52. 92.100 / 52. 92.100 libavcodec 55. 69.100 / 55. 69.100 libavformat 55. 48.100 / 55. 48.100 libavdevice 55. 13.102 / 55. 13.102 libavfilter 4. 11.100 / 4. 11.100 libavresample 1. 3. 0 / 1. 3. 0 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100
If you're working in a cabal sandbox, can you try running the demo programs with cabal run demo (after configuring with cabal configure -f BuildDemo)? This is how I run everything, and I'd like to reduce the number of variables here as there's not much to go on yet.
Running the demo the way you (acowley) suggest does indeed do the trick. Although running Main.hs in interpreter still proved to fail in described way (segfault when testDecode) even on another machine i tried it on.
Phew, I was worried about debugging this one! The segfault sounds like a GHCi linker limitation. Since you have a program that runs when compiled but not through GHCi, it's fair game to ask this of one of the GHC folks.
For what it's worth, I too get a segfault in OS X when running testDecode through cabal repl demo with GHC 7.8.3 on OS X, so it's not just a linux issue.
We run ffmpeg calls from within ghci, but rely on nix establish our baseline environment (https://github.com/databrary/databrary/blob/master/default.nix)