[FFmpeg-user] libutvideo causes Segmentation fault
Johann Rekowski
johann.rekowski at googlemail.com
Sun Mar 10 21:49:04 CET 2013
So I tried FFV1, it encodes in one thread and produces only 10 fps,
instead of the requested 30 fps. I have tried several options like
"-threads 8" and "-slices 8". Threads was ignored and slices threw out
following error:
Input:
ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0 -vcodec ffv1 -slices 8
output.avi
Output:
[ffv1 @ 0x25f2000] Version 2 needed for requested features but version 2
is experimental and not enabled
How do I enable version 2?
It seems I have to stick to utvideo codec for now.
I backtraced the segmentation fault with utvideo x64 asm optimizations:
-------------------------------
What I want to do: Record a game (screencast) with x11grab using the
latest utvideo codec compiled with "--enable-asm=x64" optimization.
-------------------------------
The problem I encountered: Segmentation fault (core dumped)
-------------------------------
The commandline I used: ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0
-vcodec libutvideo output.avi
-------------------------------
Full, uncut console output:
[hitomilinus at hitomilinus ~]$ ffmpeg -v 9 -loglevel 99 -f x11grab -r 30
-s 1920x1080 -i :0.0 -vcodec libutvideo output.avi
ffmpeg version N-36853-gde54a96 Copyright (c) 2000-2013 the FFmpeg
developers
built on Mar 10 2013 21:04:11 with gcc 4.7.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static
--enable-libfaac --enable-nonfree --enable-avresample
--enable-fontconfig --enable-gpl --enable-libass --enable-libbluray
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libopencore_amrnb
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis
--enable-libx264 --enable-libxvid --enable-postproc
--enable-runtime-cpudetect --enable-shared --enable-version3
--enable-libutvideo --enable-x11grab
libavutil 52. 19.100 / 52. 19.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 44.101 / 3. 44.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level)
with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav*
logging level) with argument '99'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'x11grab'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1920x1080'.
Reading option '-i' ... matched as input file with argument ':0.0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video
codec ('copy' to copy stream)) with argument 'libutvideo'.
Reading option 'output.avi' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file :0.0.
Applying option f (force format) with argument x11grab.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 30.
Applying option s (set frame size (WxH or abbreviation)) with argument
1920x1080.
Successfully parsed a group of options.
Opening an input file: :0.0.
[x11grab @ 0x231e180] device: :0.0 -> display: :0.0 x: 0 y: 0 width:
1920 height: 1080
[x11grab @ 0x231e180] shared memory extension found
[x11grab @ 0x231e180] All info found
[x11grab @ 0x231e180] Estimating duration from bitrate, this may be
inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1362946312.080194, bitrate: 1990656 kb/s
Stream #0:0, 1, 1/1000000: Video: rawvideo (BGR[0] / 0x524742),
bgr0, 1920x1080, 1/30, 1990656 kb/s, 30 tbr, 1000k tbn, 30 tbc
Successfully opened the file.
Parsing a group of options: output file output.avi.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument libutvideo.
Successfully parsed a group of options.
Opening an output file: output.avi.
Successfully opened the file.
[buffer @ 0x2308b40] Setting entry with key 'video_size' to value
'1920x1080'
[buffer @ 0x2308b40] Setting entry with key 'pix_fmt' to value '298'
[buffer @ 0x2308b40] Setting entry with key 'time_base' to value '1/30'
[buffer @ 0x2308b40] Setting entry with key 'pixel_aspect' to value '0/1'
[buffer @ 0x2308b40] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0x2308b40] Setting entry with key 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x23397c0] w:1920 h:1080 pixfmt:bgr0
tb:1/30 fr:30/1 sar:0/1 sws_param:flags=2
[scale @ 0x2308f00] Setting 'w' to value '0'
[scale @ 0x2308f00] Setting 'h' to value '0'
[scale @ 0x2308f00] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x2308de0] w:0 h:0 flags:'0x4' interl:0
[format @ 0x23090c0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0x2308de0] picking bgr24 out of 4 ref:bgr0 alpha:0
[graph 0 input from stream 0:0 @ 0x23397c0] TB:0.033333
FRAME_RATE:30.000000 SAMPLE_RATE:nan
[auto-inserted scaler 0 @ 0x2308de0] w:1920 h:1080 fmt:bgr0 sar:0/1 ->
w:1920 h:1080 fmt:bgr24 sar:0/1 flags:0x4
Output #0, avi, to 'output.avi':
Metadata:
ISFT : Lavf54.63.104
Stream #0:0, 0, 1/30: Video: utvideo (ULRG / 0x47524C55), bgr24,
1920x1080, 1/30, q=2-31, 200 kb/s, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> libutvideo)
Press [q] to stop, [?] for help
[force CFR for input from stream 0:0 @ 0x23095e0] N:0 PTS:0 T:0.000000
POS:nan INTERLACED:0 -> PTS:0 T:0.000000
Segmentation fault (core dumped)
-------------------------------
gdb output:
[hitomilinus at hitomilinus ~]$ gdb
/home/hitomilinus/Builds/ffmpeg-git/src/ffmpeg-build/ffmpeg_g
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/hitomilinus/Builds/ffmpeg-git/src/ffmpeg-build/ffmpeg_g...(no
debugging symbols found)...done.
(gdb) r -f x11grab -r 30 -s 1920x1080 -i :0.0 -vcodec libutvideo output.avi
Starting program:
/home/hitomilinus/Builds/ffmpeg-git/src/ffmpeg-build/ffmpeg_g -f x11grab
-r 30 -s 1920x1080 -i :0.0 -vcodec libutvideo output.avi
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
ffmpeg version N-36853-gde54a96 Copyright (c) 2000-2013 the FFmpeg
developers
built on Mar 10 2013 21:26:35 with gcc 4.7.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static
--enable-libfaac --enable-nonfree --enable-avresample
--enable-fontconfig --enable-gpl --enable-libass --enable-libbluray
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libopencore_amrnb
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis
--enable-libx264 --enable-libxvid --enable-postproc
--enable-runtime-cpudetect --enable-shared --enable-version3
--enable-libutvideo --enable-x11grab
libavutil 52. 19.100 / 52. 19.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 44.101 / 3. 44.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[x11grab @ 0x643140] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920
height: 1080
[x11grab @ 0x643140] shared memory extension found
[x11grab @ 0x643140] Estimating duration from bitrate, this may be
inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1362947697.205578, bitrate: 1990656 kb/s
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080,
1990656 kb/s, 30 tbr, 1000k tbn, 30 tbc
[New Thread 0x7fffea074700 (LWP 13681)]
[New Thread 0x7fffe9873700 (LWP 13682)]
[New Thread 0x7fffe9072700 (LWP 13683)]
[New Thread 0x7fffe8871700 (LWP 13684)]
[New Thread 0x7fffe8070700 (LWP 13685)]
[New Thread 0x7fffe786f700 (LWP 13686)]
[New Thread 0x7fffe706e700 (LWP 13687)]
[New Thread 0x7fffe686d700 (LWP 13688)]
Output #0, avi, to 'output.avi':
Metadata:
ISFT : Lavf54.63.104
Stream #0:0: Video: utvideo (ULRG / 0x47524C55), bgr24, 1920x1080,
q=2-31, 200 kb/s, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> libutvideo)
Press [q] to stop, [?] for help
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe786f700 (LWP 13686)]
0x00007ffff1b6745e in x64_sse2_PredictMedianAndCount_align16 () from
/usr/lib/libutvideo.so.12.0.1
-------------------------------
valgrind output:
[hitomilinus at hitomilinus ~]$ valgrind
/home/hitomilinus/Builds/ffmpeg-git/src/ffmpeg-build/ffmpeg_g -f x11grab
-r 30 -s 1920x1080 -i :0.0 -vcodec libutvideo output.avi
==13717== Memcheck, a memory error detector
==13717== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==13717== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==13717== Command:
/home/hitomilinus/Builds/ffmpeg-git/src/ffmpeg-build/ffmpeg_g -f x11grab
-r 30 -s 1920x1080 -i :0.0 -vcodec libutvideo output.avi
==13717==
ffmpeg version N-36853-gde54a96 Copyright (c) 2000-2013 the FFmpeg
developers
built on Mar 10 2013 21:26:35 with gcc 4.7.2 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static
--enable-libfaac --enable-nonfree --enable-avresample
--enable-fontconfig --enable-gpl --enable-libass --enable-libbluray
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libopencore_amrnb
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis
--enable-libx264 --enable-libxvid --enable-postproc
--enable-runtime-cpudetect --enable-shared --enable-version3
--enable-libutvideo --enable-x11grab
libavutil 52. 19.100 / 52. 19.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 44.101 / 3. 44.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[x11grab @ 0x105e87a0] device: :0.0 -> display: :0.0 x: 0 y: 0 width:
1920 height: 1080
[x11grab @ 0x105e87a0] shared memory extension found
[x11grab @ 0x105e87a0] Estimating duration from bitrate, this may be
inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1362947870.979006, bitrate: 1990656 kb/s
Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080,
1990656 kb/s, 30 tbr, 1000k tbn, 30 tbc
Output #0, avi, to 'output.avi':
Metadata:
ISFT : Lavf54.63.104
Stream #0:0: Video: utvideo (ULRG / 0x47524C55), bgr24, 1920x1080,
q=2-31, 200 kb/s, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> libutvideo)
Press [q] to stop, [?] for help
==13717== Thread 4:
==13717== Invalid write of size 8
==13717== at 0xAEB63F2: ??? (in /usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAD3E9: CUL00Codec::PredictProc(unsigned int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAB7A2: CThreadManager::ThreadProc(int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0x70EDE0E: start_thread (in /usr/lib/libpthread-2.17.so)
==13717== by 0x76E8EFC: clone (in /usr/lib/libc-2.17.so)
==13717== Address 0x14798d60 is just below the stack ptr. To suppress,
use: --workaround-gcc296-bugs=yes
==13717==
==13717== Invalid write of size 8
==13717== at 0xAEB645E: ??? (in /usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAD3E9: CUL00Codec::PredictProc(unsigned int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAB7A2: CThreadManager::ThreadProc(int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0x70EDE0E: start_thread (in /usr/lib/libpthread-2.17.so)
==13717== by 0x76E8EFC: clone (in /usr/lib/libc-2.17.so)
==13717== Address 0x780 is not stack'd, malloc'd or (recently) free'd
==13717==
==13717==
==13717== Process terminating with default action of signal 11 (SIGSEGV)
==13717== Access not within mapped region at address 0x780
==13717== at 0xAEB645E: ??? (in /usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAD3E9: CUL00Codec::PredictProc(unsigned int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0xAEAB7A2: CThreadManager::ThreadProc(int) (in
/usr/lib/libutvideo.so.12.0.1)
==13717== by 0x70EDE0E: start_thread (in /usr/lib/libpthread-2.17.so)
==13717== by 0x76E8EFC: clone (in /usr/lib/libc-2.17.so)
==13717== If you believe this happened as a result of a stack
==13717== overflow in your program's main thread (unlikely but
==13717== possible), you can try to increase the size of the
==13717== main thread stack using the --main-stacksize= flag.
==13717== The main thread stack size used in this run was 8388608.
==13717==
==13717== HEAP SUMMARY:
==13717== in use at exit: 27,674,279 bytes in 602 blocks
==13717== total heap usage: 3,430 allocs, 2,828 frees, 29,155,547
bytes allocated
==13717==
==13717== LEAK SUMMARY:
==13717== definitely lost: 288 bytes in 1 blocks
==13717== indirectly lost: 0 bytes in 0 blocks
==13717== possibly lost: 2,016 bytes in 7 blocks
==13717== still reachable: 27,671,975 bytes in 594 blocks
==13717== suppressed: 0 bytes in 0 blocks
==13717== Rerun with --leak-check=full to see details of leaked memory
==13717==
==13717== For counts of detected and suppressed errors, rerun with: -v
==13717== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 2 from 2)
Killed
-------------------------------
I am not sure if you guys can do anything to fix this, I'm just posting
this, hoping to find a fix for the asm optimizations.
More information about the ffmpeg-user
mailing list