Opened 8 years ago

Closed 3 years ago

#5536 closed defect (needs_more_info)

Segmentation fault (core dumped) on large file

Reported by: Sap1ens Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: libx265 crash
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am using ffmpeg to compress some big images (about 3500 3000x8000 .tiff files) and I am using this command:

ffmpeg -y -framerate 30 -start_number 13244 -i sources/full/full_0%03d.tif -c:v libx265 -r 30 -x265-params crf=22 -pix_fmt yuv420p sources/full_brain.mp4

When I run it on small sets of small images, it works just fine, but on the big images it crashes after a few frames with messages like

Segmentation fault (core dumped)      0kB time=00:00:00.00 bitrate=N/A speed=   0x

I tried compressing fewer files, but it still segfaults. I don't think that it is a memory problem, since I have 96 GB of RAM and the same amount of swap. Also I tried again the command on the smaller sets and it keeps going just fine.
I am running Ubuntu 14.04.4 LTS (school property, I don't have sudo privileges) and using the static build.
I have included a log file generated with -report, please tell me if you need anything else.
Also, I just noticed that H.264 encoding through libx264 does not run into the problem, still I would need HEVC encoding if possible.
Thank you in advance,
Enrico

Attachments (2)

ffmpeg-20160510-223440.log (14.5 KB ) - added by Sap1ens 8 years ago.
gdb.log (14.6 KB ) - added by Sap1ens 8 years ago.

Download all attachments as: .zip

Change History (18)

by Sap1ens, 8 years ago

Attachment: ffmpeg-20160510-223440.log added

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 8 years ago

Component: ffmpegundetermined
Keywords: large images mp4 libx265 HEVC removed

Replying to Sap1ens:

Segmentation fault (core dumped)      0kB time=00:00:00.00 bitrate=N/A speed=   0x

Did you attach the correct log file? I don't see this message in the console output you attached...

Please provide the necessary input file(s).

comment:2 by James, 8 years ago

Please check https://ffmpeg.org/bugreports.html
We can't do much without a way to reproduce the crash (Smallest sample possible that generates the crash uploaded somewhere) or at least an useful gdb output.

But judging by what you said about libx264 not crashing, it sounds like the problem may be in libx265 and not ffmpeg.

in reply to:  1 comment:3 by Sap1ens, 8 years ago

Right, forgot the console output.

ffmpeg version N-53477-g689211d-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-10) 20160224
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.100 / 57. 28.100
  libavformat    57. 28.100 / 57. 28.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'sources/full/full_0%03d.tif':
  Duration: 00:02:01.53, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: tiff, gray, 3662x8250 [SAR 1:1 DAR 1831:4125], 30 tbr, 30 tbn, 30 tbc
x265 [info]: HEVC encoder version 1.9+73-6d06de58c316
x265 [info]: build info [Linux][GCC 5.3.1][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-6 (Main tier)
x265 [info]: Thread pool created using 32 threads
x265 [info]: frame threads / pool features       : 8 / wpp(129 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / 1 / 1
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-22.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=8 deblock sao
Output #0, mp4, to 'sources/full_brain.mp4':
  Metadata:
    encoder         : Lavf57.28.100
    Stream #0:0: Video: hevc (libx265) ([35][0][0][0] / 0x0023), yuv420p, 3662x8250 [SAR 1:1 DAR 1831:4125], q=2-31, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.28.100 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (tiff (native) -> hevc (libx265))
Press [q] to stop, [?] for help
Segmentation fault (core dumped)      0kB time=00:00:00.00 bitrate=N/A speed=   0x

Replying to cehoyos:

Replying to Sap1ens:

Segmentation fault (core dumped)      0kB time=00:00:00.00 bitrate=N/A speed=   0x

Did you attach the correct log file? I don't see this message in the console output you attached...

Please provide the necessary input file(s).

in reply to:  2 ; comment:4 by Sap1ens, 8 years ago

I am quite a newbie, how would I get a gdb output?

Replying to jamrial:

Please check https://ffmpeg.org/bugreports.html
We can't do much without a way to reproduce the crash (Smallest sample possible that generates the crash uploaded somewhere) or at least an useful gdb output.

But judging by what you said about libx264 not crashing, it sounds like the problem may be in libx265 and not ffmpeg.

in reply to:  4 ; comment:5 by James, 8 years ago

Replying to Sap1ens:

I am quite a newbie, how would I get a gdb output?

It's explained in https://ffmpeg.org/bugreports.html

How many of these tiff files concatenated are needed to reproduce the issue? If one or a small amount, can you upload them somewhere?
Also, try using a newer ffmpeg build from the same source as this one you tried, see if that helps.

in reply to:  5 ; comment:6 by Sap1ens, 8 years ago

Replying to jamrial:

Replying to Sap1ens:

I am quite a newbie, how would I get a gdb output?

It's explained in https://ffmpeg.org/bugreports.html

Right, I should have read more carefully, sorry. Still, I apparently don't have ffmpeg_g, so I'm going to look for it (compiling from source is impossible for school restrictions)

How many of these tiff files concatenated are needed to reproduce the issue? If one or a small amount, can you upload them somewhere?

I have put a handful of them in a 123MB zip file at http://sappy.altervista.org/files/sources.zip. Incidentally, I got a completely black batch.

Also, try using a newer ffmpeg build from the same source as this one you tried, see if that helps.

Tried, didn't work.

in reply to:  6 ; comment:7 by James, 8 years ago

Replying to Sap1ens:

Right, I should have read more carefully, sorry. Still, I apparently don't have ffmpeg_g, so I'm going to look for it (compiling from source is impossible for school restrictions)

ffmpeg_g is the same as ffmpeg but with debug symbols, which are needed to get useful output from gdb. You'll probably not find one out there, so since you can't compile it yourself try using ffmpeg instead. It should hopefully let us confirm if libx265 is in fact at fault, at the very least.

by Sap1ens, 8 years ago

Attachment: gdb.log added

in reply to:  6 comment:8 by Sap1ens, 8 years ago

I attached the gdb output in a log file

Last edited 8 years ago by Sap1ens (previous) (diff)

in reply to:  7 comment:9 by Sap1ens, 8 years ago

I emailed my professor, explained the situation, and we changed the assignment, so I don't need to compress the big files anymore. Thanks for the help anyway, and sorry for being a PEBKAC. Should I close the bug report?

comment:10 by Carl Eugen Hoyos, 8 years ago

The following works fine here:

$ ffmpeg -loop 1 -i full_013244.tif -f rawvideo -pix_fmt yuv420p -vframes 100 - | x265 --input-res 3662x8250 --fps=30 --input - --output out.hevc

The following commands all crash:

$ ffmpeg -loop 1 -i full_013244.tif -f rawvideo -pix_fmt yuv420p -vframes 100 - | ffmpeg -f rawvideo -s 3662x8250 -i - -threads 1 -x265-params pools=none out.hevc
$ ffmpeg -loop 1 -i full_013244.tif -f rawvideo -pix_fmt yuv420p -vframes 100 - | ffmpeg -f rawvideo -s 3662x8250 -i - out.hevc
$ ffmpeg -loop 1 -i full_013244.tif -pix_fmt yuv420p -vframes 100 out.hevc
ffmpeg version N-79948-gd1cacbb Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libx265
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 41.102 / 57. 41.102
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[tiff_pipe @ 0x3813500] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, tiff_pipe, from 'full_013244.tif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: tiff, gray, 3662x8250 [SAR 1:1 DAR 1831:4125], 25 tbr, 25 tbn
x265 [info]: HEVC encoder version 1.9+163-10763a24dfb9
x265 [info]: build info [Linux][GCC 4.7.1][64 bit] 8bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: Main profile, Level-6 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: frame threads / pool features       : 3 / wpp(129 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=8 deblock sao
[hevc @ 0x381b080] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, hevc, to 'out.hevc':
  Metadata:
    encoder         : Lavf57.36.100
    Stream #0:0: Video: hevc, yuv420p, 3662x8250 [SAR 1:1 DAR 1831:4125], q=2-31, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc57.41.102 libx265
Stream mapping:
  Stream #0:0 -> #0:0 (tiff (native) -> hevc (libx265))
Press [q] to stop, [?] for help
Segmentation fault

Works fine with much lower frame count and lower thread count or significantly lower frame count (2).

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe5120700 (LWP 28572)]
0x000000000140f871 in x265_filterPixelToShort_64x64_ssse3 ()
(gdb) bt
#0  0x000000000140f871 in x265_filterPixelToShort_64x64_ssse3 ()
#1  0x000000000147ecc3 in x265::Predict::motionCompensation(x265::CUData const&, x265::PredictionUnit const&, x265::Yuv&, bool, bool) ()
#2  0x0000000001460749 in x265::Analysis::checkMerge2Nx2N_rd0_4(x265::Mode&, x265::Mode&, x265::CUGeom const&) ()
#3  0x0000000001466538 in x265::Analysis::compressInterCU_rd0_4(x265::CUData const&, x265::CUGeom const&, int) ()
#4  0x000000000146b30e in x265::Analysis::compressCTU(x265::CUData&, x265::Frame&, x265::CUGeom const&, x265::Entropy const&) ()
#5  0x0000000001222e79 in x265::FrameEncoder::processRowEncoder(int, x265::ThreadLocalData&) ()
#6  0x00000000012213ba in x265::FrameEncoder::processRow(int, int) ()
#7  0x000000000145b872 in x265::WaveFront::findJob(int) ()
#8  0x000000000120bd12 in x265::WorkerThread::threadMain() ()
#9  0x000000000120b60a in x265::ThreadShim(void*) ()
#10 0x00007ffff6485e0e in start_thread () from /lib64/libpthread.so.0
#11 0x00007ffff4f652cd in clone () from /lib64/libc.so.6

in reply to:  10 comment:11 by Sap1ens, 8 years ago

This is working, thank you so much. Should I close the ticket even though the problem has not been clearly found?

comment:12 by Carl Eugen Hoyos, 8 years ago

Keywords: libx265 added

comment:13 by Sap1ens, 8 years ago

Resolution: worksforme
Status: newclosed

comment:14 by Carl Eugen Hoyos, 8 years ago

Resolution: worksforme
Status: closedreopened

Since the crash only happens with FFmpeg (not with x265 alone), I believe this should be analyzed.

comment:15 by Carl Eugen Hoyos, 8 years ago

Keywords: crash added

comment:16 by Elon Musk, 3 years ago

Resolution: needs_more_info
Status: reopenedclosed
Note: See TracTickets for help on using tickets.