Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
is it possible to compile x264 for webassembly using emscripten ?
4 novembre, par sunder kandasamyI am trying to build x264 code for webassembly. i use emconfigure to configure. like below
emconfigure ./configure --prefix="$(pwd)/em" --enable-shared --enable-static --disable-cli --disable-gpl
But this was throwing "No working C compiler found." error. i have gcc compiler 9.3.0 version and have tried reinstalling build-essentials and gcc but still same issue.
config.log also doesn't help.
If i provide --host cross compiler flag then it is generating libx264.so file, but i am not sure whether this is right as the wasm code should work in every browser in (windows/mac/linux)
please tell me first whether compiling x264 using emscripten is possible? If yes, please tell me what is the correct steps to do it
-
How to set correct parameters for x264 lib
29 octobre, par galukI depacketize the H264 video fragments from an IP.RTP stream and save them to video.ivf file. After depacketizing i have only [SPS] ,[PPS] and [non-IDR slice]. I try to create IDR slice by using x264 lib. x264 lib creates IDR frame which consists of 0x000001[SPS nal type 7] 0x000001[PPS nal type 8] 0x0001[SE slice nal type 6] and 0x0001[I slice nal type 5]. How to set correct parameters for x264 lib if i have real SPS and PPS frames to get the same SPS and PPS frames
i parse SPS and PPS but i don't know which parameters of x264_param_t param i should set. can someone give me some examples.
-
Adding x264 and AAC encoding to a Telegram-based FFmpeg script
1er octobre, par Pooria DarvishiI'm trying to modify a Telegram script that utilizes static FFmpeg and VPX libraries to also include x264 and AAC encoding. I'm quite new to this and could use some guidance.
Background:
Telegram uses static .a files of FFmpeg and VPX, compiled using NDK. I have the script that builds these libraries. I want to modify this script to include x264 and AAC libraries as well.
Problem:
I'm unsure how to integrate x264 and AAC into the existing build process and how to configure FFmpeg to use these codecs.
Code snippets:
build_ffmpeg.sh:
#!/bin/bash # instructions for build # used # ffmpeg 4.4.3 # lib vpx 1.10.9 # NDK for compile libvpx. Last successful build with 21.1.6352462 # NDK r10e for compile ffmpeg # # 1) download ffmpeg # 2) set NDK_r10e and NDK variables # 3) download lib vpx # 4) copy libvpx to vpx-android folder and rename as libvpx # 5) copy build_ffmpeg foleder in ffmepg directory # 6) run build_ffmpeg.sh # 7) see compiled library in build_ffmpeg/adnroid folder NDK="/Users/macbookpro/Library/Android/sdk/ndk/21.1.6352462" NDK_r10e="/Users/macbookpro/Library/Android/sdk/ndk/android-ndk-r10e" #build vpx cd ./vpx-android export ANDROID_NDK=$NDK sh build-vpx.sh cd .. cd ./x264-android export ANDROID_NDK=$NDK sh build.sh cd .. NDK=$NDK_r10e function build_one { echo "Cleaning..." rm config.h make clean echo "Configuring..." INCLUDES=" -I${PREFIX}/include" LIBS=" -L${PREFIX}/lib" cd /Users/macbookpro/Downloads/ffmpeg-4.4.3 ./configure \ --cc=$CC \ --nm=$NM \ --enable-stripping \ --arch=$ARCH \ --target-os=linux \ --enable-cross-compile \ --yasmexe=$NDK/prebuilt/darwin-x86_64/bin/yasm \ --prefix=$PREFIX \ --enable-pic \ --disable-shared \ --enable-static \ --enable-asm \ --enable-inline-asm \ --cross-prefix=$CROSS_PREFIX \ --sysroot=$PLATFORM \ --extra-cflags="${INCLUDES} -Wl,-Bsymbolic -Os -DCONFIG_LINUX_PERF=0 -DANDROID $OPTIMIZE_CFLAGS -fPIE -pie --static -fPIC" \ --extra-ldflags="${LIBS} -Wl,-Bsymbolic -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -fPIC" \ --extra-libs="-lgcc" \ \ --enable-version3 \ --enable-gpl \ \ --disable-doc \ --disable-avx \ \ --disable-everything \ --disable-network \ --disable-zlib \ --disable-avfilter \ --disable-avdevice \ --disable-postproc \ --disable-debug \ --disable-programs \ --disable-network \ \ --enable-libvpx \ --enable-decoder=libvpx_vp9 \ --enable-libx264 \ --enable-runtime-cpudetect \ --enable-pthreads \ --enable-avresample \ --enable-swscale \ --enable-protocol=file \ --enable-decoder=h264 \ --enable-decoder=mpeg4 \ --enable-decoder=mjpeg \ --enable-decoder=gif \ --enable-decoder=alac \ --enable-decoder=opus \ --enable-demuxer=mov \ --enable-demuxer=gif \ --enable-demuxer=ogg \ --enable-demuxer=matroska \ --enable-hwaccels \ --enable-runtime-cpudetect \ $ADDITIONAL_CONFIGURE_FLAG #echo "continue?" #read make -j8 install } #x86_64 PREBUILT=$NDK/toolchains/x86_64-4.9/prebuilt/darwin-x86_64 PLATFORM=$NDK/platforms/android-21/arch-x86_64 LD=$PREBUILT/bin/x86_64-linux-android-ld AR=$PREBUILT/bin/x86_64-linux-android-ar NM=$PREBUILT/bin/x86_64-linux-android-nm GCCLIB=$PREBUILT/lib/gcc/x86_64-linux-android/4.9/libgcc.a CC=$PREBUILT/bin/x86_64-linux-android-gcc CROSS_PREFIX=$PREBUILT/bin/x86_64-linux-android- ARCH=x86_64 CPU=x86_64 PREFIX=./android/x86_64 ADDITIONAL_CONFIGURE_FLAG="--disable-mmx --disable-inline-asm" build_one #arm64-v8a PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64 PLATFORM=$NDK/platforms/android-21/arch-arm64 LD=$PREBUILT/bin/aarch64-linux-android-ld AR=$PREBUILT/bin/aarch64-linux-android-ar NM=$PREBUILT/bin/aarch64-linux-android-nm GCCLIB=$PREBUILT/lib/gcc/aarch64-linux-android/4.9/libgcc.a CC=$PREBUILT/bin/aarch64-linux-android-gcc CROSS_PREFIX=$PREBUILT/bin/aarch64-linux-android- ARCH=arm64 CPU=arm64-v8a OPTIMIZE_CFLAGS= PREFIX=./android/arm64-v8a ADDITIONAL_CONFIGURE_FLAG="--enable-neon --enable-optimizations" build_one #arm v7n PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 PLATFORM=$NDK/platforms/android-16/arch-arm LD=$PREBUILT/bin/arm-linux-androideabi-ld AR=$PREBUILT/bin/arm-linux-androideabi-ar NM=$PREBUILT/bin/arm-linux-androideabi-nm GCCLIB=$PREBUILT/lib/gcc/arm-linux-androideabi/4.9/libgcc.a CC=$PREBUILT/bin/arm-linux-androideabi-gcc CROSS_PREFIX=$PREBUILT/bin/arm-linux-androideabi- ARCH=arm CPU=armv7-a OPTIMIZE_CFLAGS="-marm -march=$CPU" PREFIX=./android/armeabi-v7a ADDITIONAL_CONFIGURE_FLAG=--enable-neon build_one #x86 PREBUILT=$NDK/toolchains/x86-4.9/prebuilt/darwin-x86_64 PLATFORM=$NDK/platforms/android-16/arch-x86 LD=$PREBUILT/bin/i686-linux-android-ld AR=$PREBUILT/bin/i686-linux-android-ar NM=$PREBUILT/bin/i686-linux-android-nm GCCLIB=$PREBUILT/lib/gcc/i686-linux-android/4.9/libgcc.a CC=$PREBUILT/bin/i686-linux-android-gcc CROSS_PREFIX=$PREBUILT/bin/i686-linux-android- ARCH=x86 CPU=i686 OPTIMIZE_CFLAGS="-march=$CPU" PREFIX=./android/x86 ADDITIONAL_CONFIGURE_FLAG="--disable-mmx --disable-yasm" build_one if [[ -e ./build_ffmpeg/android ]]; then rm -rf ./build_ffmpeg/android fi mv ./android ./build_ffmpeg/
build-vpx.sh:
#!/bin/bash set -u . _settings.sh LIB_VPX="libvpx" LIB_GIT=v1.10.0 if [[ -f "${LIB_VPX}/build/make/version.sh" ]]; then version=`"${LIB_VPX}/build/make/version.sh" --bare "${LIB_VPX}"` fi configure_make() { pushd "${LIB_VPX}" || exit ABI=$1; echo -e "\n** BUILD STARTED: ${LIB_VPX} (${version}) for ${ABI} **" configure "$@" case ${ABI} in armeabi) TARGET="armv7-android-gcc --disable-neon --disable-neon-asm" ;; armeabi-v7a) TARGET="armv7-android-gcc --enable-neon --disable-neon-asm" ;; arm64-v8a) TARGET="arm64-android-gcc" ;; x86) TARGET="x86-android-gcc" ;; x86_64) TARGET="x86_64-android-gcc" ;; mips) TARGET="mips32-linux-gcc" ;; mips64) TARGET="mips64-linux-gcc" ;; esac make clean CPU_DETECT="--disable-runtime-cpu-detect" if [[ $1 =~ x86.* ]]; then CPU_DETECT="--enable-runtime-cpu-detect" fi ./configure \ --extra-cflags="-isystem ${NDK_SYSROOT}/usr/include/${NDK_ABIARCH} -isystem ${NDK_SYSROOT}/usr/include" \ --libc=${NDK_SYSROOT} \ --prefix=${PREFIX} \ --target=${TARGET} \ ${CPU_DETECT} \ --as=auto \ --disable-docs \ --enable-pic \ --enable-libyuv \ --enable-static \ --enable-small \ --enable-optimizations \ --enable-better-hw-compatibility \ --enable-realtime-only \ --enable-vp8 \ --enable-vp9 \ --disable-webm-io \ --disable-examples \ --disable-tools \ --disable-debug \ --disable-unit-tests || exit 1 make -j${HOST_NUM_CORES} install popd || true } for ((i=0; i < ${#ABIS[@]}; i++)) do if [[ $# -eq 0 ]] || [[ "$1" == "${ABIS[i]}" ]]; then [[ ${ANDROID_API} -lt 21 ]] && ( echo "${ABIS[i]}" | grep 64 > /dev/null ) && continue; configure_make "${ABIS[i]}" echo -e "** BUILD COMPLETED: ${LIB_VPX} for ${ABIS[i]} **\n\n" fi done
_settings.sh:
#!/bin/bash if [[ -z $ANDROID_NDK ]] || [[ ! -d $ANDROID_NDK ]] ; then echo "You need to set ANDROID_NDK environment variable, exiting" echo "Use: export ANDROID_NDK=/your/path/to/android-ndk-rxx" echo "e.g.: export ANDROID_NDK=/opt/android/android-ndk-r18b" exit 1 fi set -u ANDROID_API=21 ABIS=("armeabi-v7a" "arm64-v8a" "x86" "x86_64") BASEDIR=`pwd` NDK=${ANDROID_NDK} HOST_NUM_CORES=$(nproc) CFLAGS_="-DANDROID -fpic -fpie" LDFLAGS_="" configure() { ABI=$1; case $ABI in armeabi) NDK_ARCH="arm" NDK_ABIARCH="arm-linux-androideabi" CFLAGS="-march=armv5 -marm -finline-limit=64" LDFLAGS="" ASFLAGS="" ;; armeabi-v7a) NDK_ARCH="arm" NDK_ABIARCH="arm-linux-androideabi" CFLAGS="${CFLAGS_} -Os -march=armv7-a -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -mthumb -D__thumb__" LDFLAGS="${LDFLAGS_} -march=armv7-a" ASFLAGS="" ;; arm64-v8a) NDK_ARCH="arm64" NDK_ABIARCH="aarch64-linux-android" CFLAGS="${CFLAGS_} -O3 -march=armv8-a" LDFLAGS="${LDFLAGS_}" ASFLAGS="" ;; x86) NDK_ARCH="x86" NDK_ABIARCH="i686-linux-android" CFLAGS="${CFLAGS_} -O3 -march=i686 -mtune=intel -msse3 -mfpmath=sse -m32 -fPIC" LDFLAGS="-m32" ASFLAGS="-D__ANDROID__" ;; x86_64) NDK_ARCH="x86_64" NDK_ABIARCH="x86_64-linux-android" CFLAGS="${CFLAGS_} -O3 -march=x86-64 -mtune=intel -msse4.2 -mpopcnt -m64 -fPIC" LDFLAGS="" ASFLAGS="-D__ANDROID__" ;; esac TOOLCHAIN_PREFIX=${BASEDIR}/android-toolchain NDK_SYSROOT=${TOOLCHAIN_PREFIX}/sysroot if [[ -e ${TOOLCHAIN_PREFIX} ]]; then rm -rf ${TOOLCHAIN_PREFIX} fi [[ -d ${TOOLCHAIN_PREFIX} ]] || python3 ${NDK}/build/tools/make_standalone_toolchain.py \ --arch ${NDK_ARCH} \ --api ${ANDROID_API} \ --stl libc++ \ --install-dir=${TOOLCHAIN_PREFIX} PREFIX=../../android/${ABI} export PATH=${TOOLCHAIN_PREFIX}/bin:$PATH export CROSS_PREFIX=${TOOLCHAIN_PREFIX}/bin/${NDK_ABIARCH}- export CFLAGS="${CFLAGS}" export CPPFLAGS="${CFLAGS}" export CXXFLAGS="${CFLAGS} -std=c++11" export ASFLAGS="${ASFLAGS}" export LDFLAGS="${LDFLAGS} -L${NDK_SYSROOT}/usr/lib" export AR="${CROSS_PREFIX}ar" export AS="${CROSS_PREFIX}clang" export CC="${CROSS_PREFIX}clang" export CXX="${CROSS_PREFIX}clang++" export LD="${CROSS_PREFIX}ld" export STRIP="${CROSS_PREFIX}strip" export RANLIB="${CROSS_PREFIX}ranlib" export CPP="${CROSS_PREFIX}cpp" export NM="${CROSS_PREFIX}nm" echo "**********************************************" echo "### Use NDK=${NDK}" echo "### Use ANDROID_API=${ANDROID_API}" echo "### Install directory: PREFIX=${PREFIX}" echo "**********************************************" }
Any help would be greatly appreciated.
I'm working on an Android app that requires custom video encoding using FFmpeg. I've tried to build a newer version of FFmpeg but couldn't integrate it into my project due to the older version requirement. I've also tried pre-built scripts that support a wide range of codecs, but they don't generate the necessary .a files for libraries like x264, VPX, and AAC.
-
OpenCV VideoWriter using ffmpeg with "Could not open codec 'libx264'" Error
19 août, par user2262504I am new to OpenCV, and I want write Mat images into video using VideoWriter on Ubuntu 12.04. But when constructing VideoWriter, errors came out.
It seems that OpenCV invoke ffmpeg API using default parameters and ffmpeg invoke x264 using its default parameters. Then these setting is broken for libx264. Thus the "Could not open codec 'libx264'" error.
Anyone has ideas to solve this problem?
More specifically:
- anyone knows where and how OpenCV invoke ffmpeg API?
- how to change ffmpeg default settings using code, hopefull, can be easily embeded into OpenCV?
- will changes of default in ffmpeg be carried to libx264?
Errors:
1. Uising CV_FOURCC('H', '2', '6', '4') [libx264 @ 0x255de40] broken ffmpeg default settings detected [libx264 @ 0x255de40] use an encoding preset (e.g. -vpre medium) [libx264 @ 0x255de40] preset usage: -vpre
-vpre [libx264 @ 0x255de40] speed presets are listed in x264 --help [libx264 @ 0x255de40] profile is optional; x264 defaults to high Could not open codec 'libx264': Unspecified error 2. Using FOURCC = -1 to invoke user customized codec OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, file /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, line 505 terminate called after throwing an instance of 'cv::Exception' what(): /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp: 505: error: (-210) Gstreamer Opencv backend doesn't support this codec acutally. in function CvVideoWriter_GStreamer::open Codes:
int main(int argc, char *argv[]) { VideoWriter outputVideo; bool fourcc_on = true; //switch on / off different error if (fourcc_on) outputVideo.open("outVideo.avi", CV_FOURCC('H', '2', '6', '4'), 25, Size(100, 100), true); else outputVideo.open("outVideo.avi", -1, 25, Size(100, 100), true); if (!outputVideo.isOpened()) { cout << "Could not open the output video for write" << endl; return -1; } return 0; }
OpenCV Configuration:
-- Detected version of GNU GCC: 46 (406) -- Found OpenEXR: /usr/lib/libIlmImf.so -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- Looking for libavformat/avformat.h -- Looking for libavformat/avformat.h - found -- Looking for ffmpeg/avformat.h -- Looking for ffmpeg/avformat.h - not found -- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) -- -- General configuration for OpenCV 2.4.8 ===================================== -- Version control: unknown -- -- Platform: -- Host: Linux 3.8.0-38-generic x86_64 -- CMake: 2.8.7 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: RELEASE -- -- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /usr/bin/c++ (ver 4.6) -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/gcc -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- Precompiled headers: YES -- -- OpenCV modules: -- To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab -- Disabled: world -- Disabled by dependency: - -- Unavailable: androidcamera dynamicuda java -- -- GUI: -- QT: NO -- GTK+ 2.x: YES (ver 2.24.10) -- GThread : YES (ver 2.32.4) -- GtkGlExt: NO -- OpenGL support: NO -- -- Media I/O: -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4) -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver ) -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46) -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 3.9.5) -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1) -- OpenEXR: /usr/lib/libImath.so /usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so /usr/lib/libIlmThread.so (ver 1.6.1) -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: YES (ver 2.2.0) -- FFMPEG: YES -- codec: YES (ver 55.58.105) -- format: YES (ver 55.37.101) -- util: YES (ver 52.78.100) -- swscale: YES (ver 2.6.100) -- gentoo-style: YES -- GStreamer: -- base: YES (ver 0.10.36) -- app: YES (ver 0.10.36) -- video: YES (ver 0.10.36) -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- PvAPI: NO -- GigEVisionSDK: NO -- UniCap: NO -- UniCap ucil: NO -- V4L/V4L2: Using libv4l (ver 1.0.1) -- XIMEA: NO -- Xine: NO -- -- Other third-party libraries: -- Use IPP: NO -- Use Eigen: NO -- Use TBB: NO -- Use OpenMP: NO -- Use GCD NO -- Use Concurrency NO -- Use C=: NO -- Use Cuda: NO -- Use OpenCL: YES -- -- OpenCL: -- Version: dynamic -- Include path: /home/shixudongleo/Downloads/opencv-2.4.8/3rdparty/include/opencl/1.2 -- Use AMD FFT: NO -- Use AMD BLAS: NO -- -- Python: -- Interpreter: /usr/bin/python (ver 2.7.3) -- Libraries: /usr/lib/libpython2.7.so -- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.6.1) -- packages path: lib/python2.7/dist-packages -- -- Java: -- ant: NO -- JNI: NO -- Java tests: NO -- -- Documentation: -- Build Documentation: NO -- Sphinx: NO -- PdfLaTeX compiler: /usr/bin/pdflatex -- -- Tests and samples: -- Tests: YES -- Performance tests: YES -- C/C++ Examples: NO -- -- Install path: /usr/local -- -- cvconfig.h is in: /home/shixudongleo/Downloads/opencv-2.4.8/build -- ----------------------------------------------------------------- -- -- Configuring done -- Generating done -- Build files have been written to: /home/XXX/Downloads/opencv-2.4.8/build
FFMPEG
ffmpeg is enable to support OpenCV and libx264 is enabled when compiling ffmpeg. By using ffmpeg command line, libx264 is running normally.
$ ffmpeg -i test.avi -vcodec libx264 test.mp4 ffmpeg -i test.avi -vcodec libx264 test.mp4 > ~/Downloads/ffmpeg_log.txt ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers built on Apr 24 2014 16:39:51 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic libavutil 52. 78.100 / 52. 78.100 libavcodec 55. 58.105 / 55. 58.105 libavformat 55. 37.101 / 55. 37.101 libavdevice 55. 13.100 / 55. 13.100 libavfilter 4. 4.100 / 4. 4.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, avi, from 'test.avi': Duration: 00:00:03.73, start: 0.000000, bitrate: 1757 kb/s Stream #0:0: Video: msvideo1 (CRAM / 0x4D415243), rgb555le, 320x240, 1781 kb/s, 15 tbr, 15 tbn, 15 tbc Metadata: title : julius.avi Video #1 File 'test.mp4' already exists. Overwrite ? [y/N] y No pixel format specified, yuv444p for H.264 encoding chosen. Use -pix_fmt yuv420p for compatibility with outdated media players. [libx264 @ 0x25d08e0] using cpu capabilities: none! [libx264 @ 0x25d08e0] profile High 4:4:4 Predictive, level 1.2, 4:4:4 8-bit [libx264 @ 0x25d08e0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=12 lookahead_threads=1 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=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'test.mp4': Metadata: encoder : Lavf55.37.101 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x240, q=-1--1, 15360 tbn, 15 tbc Metadata: title : julius.avi Video #1 Stream mapping: Stream #0:0 -> #0:0 (msvideo1 -> libx264) Press [q] to stop, [?] for help frame= 56 fps=0.0 q=-1.0 Lsize= 321kB time=00:00:03.60 bitrate= 731.0kbits/s video:320kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.409949% [libx264 @ 0x25d08e0] frame I:3 Avg QP:15.36 size: 7975 [libx264 @ 0x25d08e0] frame P:38 Avg QP:26.05 size: 6230 [libx264 @ 0x25d08e0] frame B:15 Avg QP:28.25 size: 4418 [libx264 @ 0x25d08e0] consecutive B-frames: 46.4% 53.6% 0.0% 0.0% [libx264 @ 0x25d08e0] mb I I16..4: 1.4% 72.8% 25.8% [libx264 @ 0x25d08e0] mb P I16..4: 1.6% 5.7% 15.1% P16..4: 7.6% 6.3% 7.4% 0.0% 0.0% skip:56.3% [libx264 @ 0x25d08e0] mb B I16..4: 0.2% 1.0% 2.0% B16..8: 13.3% 7.8% 8.7% direct: 8.3% skip:58.8% L0:34.9% L1:36.6% BI:28.5% [libx264 @ 0x25d08e0] 8x8 transform intra:37.7% inter:2.3% [libx264 @ 0x25d08e0] coded y,u,v intra: 52.1% 42.1% 30.1% inter: 19.6% 9.2% 5.2% [libx264 @ 0x25d08e0] i16 v,h,dc,p: 56% 17% 24% 2% [libx264 @ 0x25d08e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 16% 68% 1% 1% 1% 1% 1% 1% [libx264 @ 0x25d08e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 18% 28% 5% 6% 5% 7% 5% 6% [libx264 @ 0x25d08e0] Weighted P-Frames: Y:31.6% UV:21.1% [libx264 @ 0x25d08e0] ref P L0: 70.5% 9.0% 12.1% 6.5% 2.0% [libx264 @ 0x25d08e0] ref B L0: 91.3% 8.7% [libx264 @ 0x25d08e0] kb/s:700.56
-
x264/x265 options for fast decoding while preserving quality
18 août, par user3301993I want to encode some videos in H264 and H265, and I would like to ask for help in order to chose the adequate options in x264/x265.
- My first priority is video quality. Lossless would be the best quality for example
- My second priority is fast decoding speed (ie: I would like faster decoding without sacrificing quality)
- fast decoding for me means that the decoding machine would use less CPU resources reading the resulting video
- Less RAM consumption would be a plus
- Latency is not important
- I don't care that much if the output file ends up bigger. Also, encoding speed is not important
I'm aware of the option
-tune fastdecode
in both x264 and x265. But apparently the quality gets a bit worse using it.For x264:
-tune fastdecode
is equivalent to--no-cabac --no-deblock --no-weightb --weightp 0
(My source isx264 --fullhelp
)Which options preserve quality ?
For x265:
-tune fastdecode
is equivalent to--no-deblock --no-sao --no-weightp --no-weightb --no-b-intra
(according to x265 doc)Again, which options preserve quality ?
I tried to read some documentation on these options, but I'm afraid I'm too stupid to understand if they preserve quality or not.
To explain further what I mean by "preserving quality":
I don't understand what the cabac option does exactly. But let's say for example that it adds some extra lossless compression, resulting in a smaller video file, but the decoding machine would need to do extra work to decompress the file
In that case, the
--no-cabac
option would skip that extra compression, resulting in no loss of quality, with a bigger file size, and the decoding machine would not need to decompress the extra compression, saving CPU work on the decoding sideIn this scenario, I would like to add the
--no-cabac
option, as it speeds up decoding, while preserving quality.I hope I could get my point across
Can anyone help me pick the right options ?
Thanks in advance