MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.51k stars 287 forks source link

Crash when start recording is clicked. #28

Closed ghost closed 10 years ago

ghost commented 10 years ago

Once I click on start recording SSR crashes.

==================== Starting SSR ====================
[DetectCPUFeatures] CPU features: mmx sse sse2 sse3
[FastScaler::FastScaler] BGRA to YUV420 converter: Fallback
[PageRecord::PageStart] Starting page ...
[PageRecord::PageStart] Started page.
[PageRecord::CaptureStart] Starting capturing ...
[X11Input::Init] Using X11 shared memory.
[PageRecord::CaptureStart] Started capturing.
[X11Input::run] Input thread started.
[FastScaler::Scale] Using swscale for scaling.
[PageRecord::RecordStart] Starting recording ...
[Muxer::Init] Using format matroska (Matroska).
[BaseEncoder::CreateCodec] Using codec libx264 (libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10).
[libx264 @ 0x2c059e0] using SAR=1/1
[libx264 @ 0x2c059e0] using cpu capabilities: MMX2 SSE2 SSE3 Cache64
[libx264 @ 0x2c059e0] profile High, level 3.2
[libx264 @ 0x2c059e0] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 pb_ratio=1.25 aq=1:1.00
[BaseEncoder::run] Encoder thread started.
[DetectCPUFeatures] CPU features: mmx sse sse2 sse3
[FastScaler::FastScaler] BGRA to YUV420 converter: Fallback
[Muxer::run] Muxer thread started.
[PageRecord::RecordStart] Started recording.
[Synchronizer::run] Synchronizer thread started.
Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `GtkRange::activate-slider' of type `gboolean' from rc file value "((GString*) 0x25af440)" of type `GString'
[1]    20148 segmentation fault  simplescreenrecorder

System Information

Linux jerk 3.10-2-amd64 #1 SMP Debian 3.10.7-1 (2013-08-17) x86_64 GNU/Linux
ghost commented 10 years ago

The first error above

Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `GtkRange::activate-slider' of type `gboolean' from rc file value "((GString*) 0x25af440)" of type `GString'
[1]    20148 segmentation fault  simplescreenrecorder

Was due to a invalid gtkrc setting. It still segfaults every time I try to record. I have a back trace fom gdb.

[New Thread 0x7fffcffff700 (LWP 21676)]
[PageRecord::RecordStart] Started recording.
[Synchronizer::run] Synchronizer thread started.
[PageRecord::CaptureStart] Starting capturing ...
[X11Input::Init] Using X11 shared memory.
[New Thread 0x7fffcf143700 (LWP 21677)]
[PageRecord::CaptureStart] Started capturing.
[X11Input::run] Input thread started.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffcf143700 (LWP 21677)]
0x00007ffff3db7464 in free () from /lib/x86_64-linux-gnu/libc.so.6

(gdb) bt
#0  0x00007ffff3db7464 in free () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff57be23c in av_freep () from /usr/lib/x86_64-linux-gnu/libavutil.so.52
#2  0x00007ffff5d305f3 in avcodec_get_frame_defaults () from /usr/lib/x86_64-linux-gnu/libavcodec.so.54
#3  0x0000000000420a14 in AVFrameWrapper::AVFrameWrapper (this=0x7fffbc008da0, size=2654400) at AV/AVWrapper.cpp:46
#4  0x000000000041eadb in Synchronizer::ReadVideoFrame (this=0xb12500, width=1680, height=1050, data=0x7fffcf144000 "' \034", stride=6720, format=AV_PIX_FMT_BGRA, 
    timestamp=161628254912) at AV/Output/Synchronizer.cpp:208
#5  0x0000000000423616 in VideoSource::PushVideoFrame (this=this@entry=0xbd1ff0, width=1680, height=1050, data=data@entry=0x7fffcf144000 "' \034", stride=stride@entry=6720, 
    format=format@entry=AV_PIX_FMT_BGRA, timestamp=timestamp@entry=161628254912) at AV/SourceSink.cpp:85
#6  0x0000000000414afe in X11Input::InputThread (this=0xbd1fe0) at AV/Input/X11Input.cpp:418
#7  0x00007ffff48caf10 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff40ece0e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007ffff3e2193d in clone () from /lib/x86_64-linux-gnu/libc.so.6
MaartenBaert commented 10 years ago

The function you show is a very simple function from ffmpeg/libav, I don't understand how it could fail. It would help if you could tell me the version of ffmpeg/libav you have by running one of these:

ffmpeg --version
avconv --version

Post all the output here, including all configuration flags, it is useful for me.

There's a suspicious comment in the function that's causing the crash: http://ffmpeg.org/doxygen/trunk/libavcodec_2utils_8c_source.html#l00992

// extended_data should explicitly be freed when needed, this code is unsafe currently
// also this is not compatible to the <55 ABI/API
if (frame->extended_data != frame->data && 0)
    av_freep(&frame->extended_data);

I haven't done anything special for the v55 API, and this code could easily cause what you're seeing since those variables aren't initialized. What I don't understand is why I'm not hitting the same bug since I also have that version ...

Anyway, I am now reading the ffmpeg docs again and I will try to come up with something that works for all versions.

ghost commented 10 years ago

Sorry the bug report was lacking so much information. Both ffmpeg/libav are from debian 7.1.

I looked at the Debian source package and --enable-pthreads is on.

ffmpeg -version:

ffmpeg -version
ffmpeg version 0.8.7-6:0.8.7-1, Copyright (c) 2000-2013 the Libav developers
  built on May 20 2013 12:25:19 with gcc 4.7.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
ffmpeg 0.8.7-6:0.8.7-1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 1
libpostproc  52.  0. 0 / 52.  0. 0

avconv -version

avconv version 0.8.7-6:0.8.7-1, Copyright (c) 2000-2013 the Libav developers
  built on May 20 2013 12:25:19 with gcc 4.7.3
avconv 0.8.7-6:0.8.7-1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 1
libpostproc  52.  0. 0 / 52.  0. 0

If I left out any information, or you still need more let me know. Thanks!

MaartenBaert commented 10 years ago

Weird, you're actually using a really old version, I suspected it was a very new version. But I think I've figured out what's wrong, it will take some time to fix it though.

ghost commented 10 years ago

No rush, thanks again.

MaartenBaert commented 10 years ago

I think I've fixed it now. Can you give it a try?

ghost commented 10 years ago

It failed to compile for me this time around.

Output/simplescreenrecorder-VideoEncoder.o `test -f 'AV/Output/VideoEncoder.cpp' || echo './'`AV/Output/VideoEncoder.cpp
mv -f AV/Output/.deps/simplescreenrecorder-VideoEncoder.Tpo AV/Output/.deps/simplescreenrecorder-VideoEncoder.Po
g++ -DHAVE_CONFIG_H -I. -I..  -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui   -I./AV/Input -I./AV/Output -I./AV -I./GUI  -pthread -std=c++0x -flax-vector-conversions -g -O2 -MT AV/Output/simplescreenrecorder-X264Presets.o -MD -MP -MF AV/Output/.deps/simplescreenrecorder-X264Presets.Tpo -c -o AV/Output/simplescreenrecorder-X264Presets.o `test -f 'AV/Output/X264Presets.cpp' || echo './'`AV/Output/X264Presets.cpp
mv -f AV/Output/.deps/simplescreenrecorder-X264Presets.Tpo AV/Output/.deps/simplescreenrecorder-X264Presets.Po
g++ -DHAVE_CONFIG_H -I. -I..  -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui   -I./AV/Input -I./AV/Output -I./AV -I./GUI  -pthread -std=c++0x -flax-vector-conversions -g -O2 -MT AV/simplescreenrecorder-AVWrapper.o -MD -MP -MF AV/.deps/simplescreenrecorder-AVWrapper.Tpo -c -o AV/simplescreenrecorder-AVWrapper.o `test -f 'AV/AVWrapper.cpp' || echo './'`AV/AVWrapper.cpp
AV/AVWrapper.cpp: In constructor ‘AVFrameWrapper::AVFrameWrapper(const std::shared_ptr<AVFrameData>&)’:
AV/AVWrapper.cpp:47:27: error: ‘av_frame_alloc’ was not declared in this scope
AV/AVWrapper.cpp: In destructor ‘AVFrameWrapper::~AVFrameWrapper()’:
AV/AVWrapper.cpp:55:24: error: ‘av_frame_free’ was not declared in this scope
make[2]: *** [AV/simplescreenrecorder-AVWrapper.o] Error 1
make[2]: Leaving directory `/home/gregf/ssr/src'
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
make[1]: Leaving directory `/home/gregf/ssr'
MaartenBaert commented 10 years ago

Apparently ffmpeg/libav changed something important without putting it in their APIchanges log. And I can't find the relevant change in their commits either.

It will probably be easier to just get your version and install it in a VM. What version of debian are you using?

EDIT: I tried something else, does this work?

ghost commented 10 years ago

It works beautifully now. Thank you for going out of your way to fix this one.

jamesvh commented 9 years ago

i am starting to have the same problem and don't know much about lubuntu on how to get a bug report

jamesvh commented 9 years ago

actually now i just ran the GDB and it says no debugging symbols found it stops working when i hit start recording.

MaartenBaert commented 9 years ago

@jamesvh Please send me the logfile saved at ~/.ssr/logs.

You can ignore the 'no debugging symbols found' warning in SSR, just run 'gdb simplescreenrecorder', type 'run', wait for the crash, and type 'bt'. A backtrace without complete debugging symbols is still useful.

jamesvh commented 9 years ago

like its not really crashing...its freezing right after i hit start record. the last thing it says on the debug before i have to force quit is "[muxer::Init] Using format flv (FLV format)

On Tue, Oct 14, 2014 at 12:25 PM, MaartenBaert notifications@github.com wrote:

@jamesvh https://github.com/jamesvh Please send me the logfile saved at ~/.ssr/logs.

You can ignore the 'no debugging symbols found' warning in SSR, just run 'gdb simplescreenrecorder', type 'run', wait for the crash, and type 'bt'. A backtrace without complete debugging symbols is still useful.

— Reply to this email directly or view it on GitHub https://github.com/MaartenBaert/ssr/issues/28#issuecomment-59083349.

MaartenBaert commented 9 years ago

In that case, run it through gdb, and when it freezes, press CTRL+C. Then type 'bt'. It will tell you where SSR got stuck (most likely inside ffmpeg/libav, but I would like to know the exact function).

The reason why I asked for the log file is because it contains important details that I may need to reproduce the problem (e.g. library versions, the settings you used, ...) The file also contains lines that are not visible in the GUI (e.g. errors from ffmpeg/libav). Can you please post the full log file?