Newest 'x264' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/x264

Les articles publiés sur le site

  • EC2 for video-encoding

    3 mars 2022, par Naftuli Kay

    I have a potential job which will require me to do some video encoding with FFMPEG and x264. I'll have a series of files which I'll need to encode once, then I'll be able to bring down the instances. Since I'm not really sure of the resource utilization of x264 and FFMPEG, what kind of instances should I get? I'm thinking either a

    High-CPU Extra Large Instance

    7 GB of memory
    20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each)
    1690 GB of instance storage
    64-bit platform
    I/O Performance: High
    API name: c1.xlarge

    or, alternatively a

    Cluster GPU Quadruple Extra Large Instance

    22 GB of memory
    33.5 EC2 Compute Units (2 x Intel Xeon X5570, quad-core “Nehalem” architecture)
    2 x NVIDIA Tesla “Fermi” M2050 GPUs
    1690 GB of instance storage
    64-bit platform
    I/O Performance: Very High (10 Gigabit Ethernet)
    API name: cg1.4xlarge

    What should I use? Does x264/FFMPEG perform better with faster/more CPUs or does it really pound the GPU more? In any case, it seems that the Cluster GPU seems to be the higher performance instance. What should I prefer?

  • How to encode an mp4 to the exact specs of another mp4 with FFMPEG

    15 décembre 2021, par BCooper

    I'm working on a batch file to concatenate 3 files together, as follows:

    1_Intro_Bumper.mp4,
    2_Session.mp4,
    3_Outro_Bumper.mp4
    

    I've run into problems with the session.mp4 having slightly different specs, causing the concat to have weird problems with speed/sync/etc, and found out that if I encode the Bumpers through Handbrake to the exact specs of the Session, then the concat works great.

    My question is: Can I bypass Handbrake here and include a line in my batch file to encode the Intro and Outro Bumpers to the exact specs of the Session?

    Here's my current batch file:

    :: Create File List
    
    for %%i in (*.mp4) do echo file '%%i'>> mylist.txt
    
    :: Concatenate Files
    
    ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
    
    :: Encode to x264
    
    ffmpeg -i output.mp4 output_x264.mp4
    

    Thanks!

  • build x264 failed on apple M1, No working C compiler found

    29 novembre 2021, par louxiu
    1. Apple M1, clang
    Apple clang version 13.0.0 (clang-1300.0.29.3)
    Target: arm64-apple-darwin21.1.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
    1. x264 version x264-snapshot-20191217-2245

    2. configure

     ./configure --prefix=/tmp/  --enable-static
    
    1. config.log
    checking for -Werror=unknown-warning-option... yes
    checking for -mdynamic-no-pic... yes
    x264 configure script
    Command line options: "--prefix=/tmp/" "--enable-static"
    
    checking whether gcc works... no
    Failed commandline was:
    --------------------------------------------------
    gcc conftest.c  -Wall -I. -I$(SRCPATH) -mdynamic-no-pic -arch armv7  -Werror=unknown-warning-option    -lm -arch armv7 -o conftest
    ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a (5 slices)
    ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libm.tbd, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libm.tbd (3 slices)
    ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd (3 slices)
    ld: dynamic main executables must link with libSystem.dylib for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    --------------------------------------------------
    Failed program was:
    --------------------------------------------------
    int main (void) {  return 0; }
    --------------------------------------------------
    DIED: No working C compiler found.
    
  • ffmpeg-python video conversion error : malloc of size 36254012 failed on Raspberry Pi

    23 novembre 2021, par Bob Smith

    I am trying to convert a .mkv file into .mp4 format using the ffmpeg-python python library. I have been able to run my script on a Windows machine repeatedly without any issues, however when I run the same script on a Raspberry Pi 4 B I am faced with the same error again and again. Similar to this post, I am faced with the following message:

    x264 [error]: malloc of size 36254012 failed
    Video encoding failed
    

    I have tried setting max_muxing_queue_size to 9999 as heard this might fix the issue, it had no effect. I tried increasing the gpu RAM from the default 128 MB to as much as 512 MB (I have the 8 GB RAM model so I was not concerned about overall system memory), needless to say this had no effect either.

    Finally, I read on a forumn post from someone else with the same error that decresing the number of threads ffmpeg uses to 1 might also solve this issue. This did in fact solve my problem, unfortunately it decreases the speed of the process to a crawl of what it would otherwise be. I was hoping someone might have another idea of how to fix this that would still allow for multiple threads to be used by ffmpeg, or at least have some idea as to what might be causing this issue.

    Also it's not particularly useful, but for reference the line that is causing the exception in the code is the following:

    ffmpeg.input(video_file).output(out_name, **{'max_muxing_queue_size': '9999'}).run()
    
  • FFmpeg libxh264 error on Slackware current

    22 novembre 2021, par unixbhaskar

    Well, here are specs which gives you heads up before suggesting ...

    bhaskar@Slackware_06:46:54_Sat Nov 20: :~>ffmpeg -codecs | grep h264
    ffmpeg version 4.4.1 Copyright (c) 2000-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.1/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --disable-encoder=aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libbluray --enable-libcaca --enable-libcdio --enable-frei0r --enable-openal --enable-libopus --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libmp3lame --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-libxml2 --enable-librsvg --enable-libdrm
      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
     DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m ) (encoders: h264_v4l2m2m h264_vaapi )
    

    Also

    ffmpeg version 4.4.1 Copyright (c) 2000-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.1/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --disable-encoder=aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libbluray --enable-libcaca --enable-libcdio --enable-frei0r --enable-openal --enable-libopus --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libmp3lame --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-libxml2 --enable-librsvg --enable-libdrm
      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
    Guessed Channel Layout for Input Stream #0.0 : stereo
    Input #0, alsa, from 'pulse':
      Duration: N/A, start: 1637371168.782400, bitrate: 1536 kb/s
      Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    [x11grab @ 0x87db00] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #1, x11grab, from ':0':
      Duration: N/A, start: 1637371168.825367, bitrate: 839270 kb/s
      Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 839270 kb/s, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
    Unknown encoder 'libx264'
    

    And ..

    bhaskar@Slackware_06:50:02_Sat Nov 20: :~>uname -a
    Linux Slackware 5.15.1-Slackware #1 SMP Sun Nov 7 10:48:30 IST 2021 x86_64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz GenuineIntel GNU/Linux
    bhaskar@Slackware_06:50:04_Sat Nov 20: :~>cat /etc/os-release
    ───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
           │ File: /etc/os-release
    ───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       1   │ NAME=Slackware
       2   │ VERSION="15.0"
       3   │ ID=slackware
       4   │ VERSION_ID=15.0
       5   │ PRETTY_NAME="Slackware 15.0 x86_64"
       6   │ ANSI_COLOR="0;34"
       7   │ CPE_NAME="cpe:/o:slackware:slackware_linux:15.0"
       8   │ HOME_URL="http://slackware.com/"
       9   │ SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
      10   │ BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
      11   │ VERSION_CODENAME=stable
    

    Wondering .....when try to build it like mentioned in this place :

    https://www.linuxquestions.org/questions/slackware-14/ffmpeg-unknown-encoder-%27libx264%27-4175677695/#post6140669

    Am I the only one , who failed to understand ,why the heck is not detecting ??

    Also,

    root@Slackware_06:52:59_Sat Nov 20:~#ldconfig -p | grep libxh264
    root@Slackware_06:53:12_Sat Nov 20:~#ldconfig -p | grep h264
    root@Slackware_06:54:18_Sat Nov 20:~#ls /usr/lib64/libxh2*
    ls: cannot access '/usr/lib64/libxh2*': No such file or directory
    root@Slackware_06:54:46_Sat Nov 20:~#ls /usr/lib/libx2*
    ls: cannot access '/usr/lib/libx2*': No such file or directory
    

    Finally....also

    bhaskar@Slackware_06:56:58_Sat Nov 20: :~>ffmpeg -encoders | grep h264
    ffmpeg version 4.4.1 Copyright (c) 2000-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.1/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --disable-encoder=aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libbluray --enable-libcaca --enable-libcdio --enable-frei0r --enable-openal --enable-libopus --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libmp3lame --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-libxml2 --enable-librsvg --enable-libdrm
      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
     V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
     V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)
    

    Greatly appreciated if you come close or pinpoint the reason.

    Thanks.