LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-19-2022, 11:17 AM   #1
gnw
LQ Newbie
 
Registered: Jun 2019
Distribution: Slackware, openSUSE
Posts: 13

Rep: Reputation: Disabled
ffmpeg: segmentation fault when trying to encode using libx264


Hi,

I have a video file (ANMR0007.mp4) recorded at 120fps and I want to reduce its size using ffmpeg:

Code:
ffmpeg -y -i ANMR0007.mp4 -c:v libx264 -b:v 88700k -pass 1 -c:a copy -f null /dev/null
ffmpeg -i ANMR0007.mp4 -c:v libx264 -b:v 88700k -pass 2 -c:a copy output.mp4
I am getting "segmentation fault" in the middle of the second pass. I am using alien's restricted ffmpeg-4.4.2-x86_64 on Slackware-current.

Do you have any suggestions?
 
Old 06-19-2022, 01:13 PM   #2
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 982

Rep: Reputation: 668Reputation: 668Reputation: 668Reputation: 668Reputation: 668Reputation: 668
Suggestions would depend upon what you want to accomplish.

If you only want to convert your video file, try some other tool like mencoder instead.

If you want to avoid segfaults and other bugs, try some stable version of Slackware like 15.0 or maybe 14.2 which has slackbuilds for ffmpeg.

If you really want to be a beta tester and provide useful patches and bug-fixes, start by typing:

ulimit -c 512000

and then reproduce the bug. Then the segfault will give you a core file which you can use in your favorite debugger. To make the corefile useful, you will probably have to recompile ffmpeg with the -g switch to get debug symbols. Once you have found the cause of the bug you might get an idea on how to fix it.

regards Henrik
 
Old 06-19-2022, 01:46 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
You won't gain much with h/x264 with 2 pass. That's works well with mpeg.

Can you post the output to
Code:
ffprobe -probesize 1000000000 -analyzeduration 100000000 -i ANMR0007.mp4
-b:v 88700k That is huge. This is either a really large video and/or really high def, and/or a high frame rate.

ffmpeg has some presets for x264 that work well.

From what you posted, example
Code:
ffmpeg -i ANMR0007.mp4 -c:a copy -c:v libx264 -crf 18 -preset slow -s <size> Output.mp4
ffmpeg -x264 -presets
ultrafast
superfast
veryfast
faster
fast
medium – default preset
slow
slower
veryslow
placebo
 
Old 06-19-2022, 02:22 PM   #4
gnw
LQ Newbie
 
Registered: Jun 2019
Distribution: Slackware, openSUSE
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thank you for your replies.

Quote:
Originally Posted by henca View Post
If you only want to convert your video file, try some other tool like mencoder instead.
Unfortunately, mencoder in slackware64-current doesn't support x264.

Quote:
Originally Posted by teckk View Post
Can you post the output to
ffprobe -probesize 1000000000 -analyzeduration 100000000 -i ANMR0007.mp4

Code:
ffprobe -probesize 1000000000 -analyzeduration 100000000 -i ANMR0007.mp4
ffprobe version 4.4.2 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11.2.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/doc/ffmpeg-4.4.2 --mandir=/usr/man --enable-gpl --enable-version3 --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libass --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librsvg --enable-libsmbclient --enable-libssh --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-postproc --enable-runtime-cpudetect --enable-sdl2 --enable-vaapi --enable-vdpau --enable-pthreads --enable-bzlib --enable-zlib --enable-shared --enable-static --disable-debug --enable-libbluray --enable-frei0r --enable-openal --enable-opencl --enable-libpulse --enable-libvidstab --enable-libwebp --enable-libfdk-aac --enable-openssl --enable-nonfree --arch=x86_64 --enable-pic --extra-cflags='-I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include -I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include/SDL2 -DRUNTIME_CPUDETECT' --extra-ldflags='-L/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/lib64 -lpthread -ldl -lssl -lcrypto -lz -lusb -ldrm' --pkg-config-flags=--static
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ANMR0007.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
  Duration: 00:11:02.51, start: 0.000000, bitrate: 28757 kb/s
  Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 28653 kb/s, 117.45 fps, 1k tbr, 1k tbn, 2k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 68 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
 
Old 06-19-2022, 02:32 PM   #5
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
Quote:
Duration: 00:11:02.51, start: 0.000000, bitrate: 28757 kb/s
The original is 28757 kb/s and you are trying to re-encode it to -b:v 88700k. Why? That won't make it any better, It will make the file size a lot bigger and you have re-encoded it again.

The only reason to re-encode that from x264 to x264 would be if you want a smaller file size. It is h264 and aac.

Or, 117.45 fps, if you want to drop the frame rate down to 60, 30, 24.

68 kb/s is only fair sound quality.

What was your goal?
 
Old 06-19-2022, 02:39 PM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
https://superuser.com/questions/1088...out-reencoding
https://stackoverflow.com/questions/...ange-framerate
 
Old 06-19-2022, 02:39 PM   #7
gnw
LQ Newbie
 
Registered: Jun 2019
Distribution: Slackware, openSUSE
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
The original is 28757 kb/s and you are trying to re-encode it to -b:v 88700k. Why? That won't make it any better, It will make the file size a lot bigger and you have re-encoded it again.
I noticed that mistake when I ran ffprobe.

Quote:
Originally Posted by teckk View Post
What was your goal?
Reduce the size. I am running it again using the preset that you suggested. Thank you.
 
Old 06-19-2022, 03:01 PM   #8
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
Reduce the frame rate without re-encoding. That will reduce the size. You'll just need to sync the audio.
120fps down to 30fps will reduce it a lot.
 
Old 06-20-2022, 07:22 AM   #9
gnw
LQ Newbie
 
Registered: Jun 2019
Distribution: Slackware, openSUSE
Posts: 13

Original Poster
Rep: Reputation: Disabled
I was able to fix the segmentation fault issue by adding -vsync cfr to the first pass (based on this post).
These were the commands that I used, which produced a good quality video and reduced the size of the file a lot:
Code:
ffmpeg -y -i ANMR0007.mp4 -c:v libx264 -b:v 3000k -r 60 -vsync cfr -pass 1 -c:a copy -f null /dev/null
ffmpeg -i ANMR0007.mp4 -c:v libx264 -b:v 3000k -r 60 -pass 2 -c:a copy output.mp4
This command suggested by teckk produced a file bigger than the input.
Code:
ffmpeg -i ANMR0007.mp4 -c:a copy -c:v libx264 -crf 18 -preset slow Output.mp4
 
Old 06-21-2022, 05:18 AM   #10
Regnad Kcin
Member
 
Registered: Jan 2014
Location: Beijing
Distribution: Slackware 64 -current .
Posts: 663

Rep: Reputation: 460Reputation: 460Reputation: 460Reputation: 460Reputation: 460
I'm no expert on ffmpeg but I have use Alien Bob's restricted ffmpeg on many video projects on --current with no problems.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Segmentation fault when run encode with VP8 on QEMU for ARM linux hero132 Slackware 0 08-24-2010 10:03 PM
LINUX UBUNTU PHP FFMPEG INSTALLED BUT libx264 while installing ERROR??? trinay123 Ubuntu 2 03-13-2010 10:22 AM
slack13_64 - FFMPEG's "libx264 not found" error erickFis Slackware 24 11-14-2009 08:12 PM
[FFMPEG] Error with libx264 not found nikhil010586 Linux - Software 11 09-23-2009 03:48 AM
dependency issue: libx264.so.54 needed by ffmpeg PhilTR Fedora 22 01-23-2007 11:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration