Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
FPS too high when saving video in mp4 container
18 janvier 2016, par theateistWhen I decode frames from avi file and then decode them in x264 and save to mp4 file, the fps of the output file is always 12,800. Therefore the file is played very fast. But, when I save the encoded in h264 frames in avi format and not mp4, so the fps is as I wanted - 25.
What could be the problem?
Here the code I wrote in VS2010:
#include "stdafx.h" #include "inttypes.h" extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavutil/avutil.h" #include
swscale.h> #include opt.h> #include swscale.h> #include imgutils.h> } #include using namespace std; int main(int argc, char* argv[]) { const char* inFileName = "C:\\000227_C1_GAME.avi"; const char* outFileName = "c:\\test.avi"; const char* outFileType = "avi"; av_register_all(); AVFormatContext* inContainer = NULL; if(avformat_open_input(&inContainer, inFileName, NULL, NULL) < 0) exit(1); if(avformat_find_stream_info(inContainer, NULL) < 0) exit(1); // Find video stream int videoStreamIndex = -1; for (unsigned int i = 0; i < inContainer->nb_streams; ++i) { if (inContainer->streams[i] && inContainer->streams[i]->codec && inContainer->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { videoStreamIndex = i; break; } } if (videoStreamIndex == -1) exit(1); AVFormatContext* outContainer = NULL; if(avformat_alloc_output_context2(&outContainer, NULL, outFileType, outFileName) < 0) exit(1); // ---------------------------- // Decoder // ---------------------------- AVStream const *const inStream = inContainer->streams[videoStreamIndex]; AVCodec *const decoder = avcodec_find_decoder(inStream->codec->codec_id); if(!decoder) exit(1); if(avcodec_open2(inStream->codec, decoder, NULL) < 0) exit(1); // ---------------------------- // Encoder // ---------------------------- AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264); if(!encoder) exit(1); AVStream *outStream = avformat_new_stream(outContainer, encoder); if(!outStream) exit(1); avcodec_get_context_defaults3(outStream->codec, encoder); // Construct encoder if(outContainer->oformat->flags & AVFMT_GLOBALHEADER) outStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; outStream->codec->coder_type = AVMEDIA_TYPE_VIDEO; outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P; outStream->codec->width = inStream->codec->width; outStream->codec->height = inStream->codec->height; outStream->codec->codec_id = encoder->id; outStream->codec->bit_rate = 500000; //outStream->codec->rc_min_rate = 600000; //outStream->codec->rc_max_rate = 800000; outStream->codec->time_base.den = 25; outStream->codec->time_base.num = 1; outStream->codec->gop_size = 250; // Keyframe interval(=GOP length). Determines maximum distance distance between I-frames outStream->codec->keyint_min = 25; // minimum GOP size outStream->codec->max_b_frames = 3;//16; // maximum number of B-frames between non-B-frames outStream->codec->b_frame_strategy = 1; // decides the best number of B-frames to use. Default mode in x264. outStream->codec->scenechange_threshold = 40; outStream->codec->refs = 6; // abillity to reference frames other than the one immediately prior to the current frame. specify how many references can be used. outStream->codec->qmin = 0;//10; outStream->codec->qmax = 69;//51; outStream->codec->qcompress = 0.6; outStream->codec->max_qdiff = 4; outStream->codec->i_quant_factor = 1.4;//0.71; outStream->codec->refs=1;//3; outStream->codec->chromaoffset = -2; outStream->codec->thread_count = 1; outStream->codec->trellis = 1; outStream->codec->me_range = 16; outStream->codec->me_method = ME_HEX; //hex outStream->codec->flags2 |= CODEC_FLAG2_FAST; outStream->codec->coder_type = 1; if(outStream->codec->codec_id == AV_CODEC_ID_H264) { av_opt_set(outStream->codec->priv_data, "preset", "slow", 0); } // Open encoder if(avcodec_open2(outStream->codec, encoder, NULL) < 0) exit(1); // Open output container if(avio_open(&outContainer->pb, outFileName, AVIO_FLAG_WRITE) < 0) exit(1); //close_o AVFrame *decodedFrame = avcodec_alloc_frame(); if(!decodedFrame) exit(1); AVFrame *encodeFrame = avcodec_alloc_frame(); if(!encodeFrame) exit(1); encodeFrame->format = outStream->codec->pix_fmt; encodeFrame->width = outStream->codec->width; encodeFrame->height = outStream->codec->height; if(av_image_alloc(encodeFrame->data, encodeFrame->linesize, outStream->codec->width, outStream->codec->height, outStream->codec->pix_fmt, 1) < 0) exit(1); av_dump_format(inContainer, 0, inFileName,0); //Write header to ouput container avformat_write_header(outContainer, NULL); AVPacket decodePacket, encodedPacket; int got_frame, len; while(av_read_frame(inContainer, &decodePacket)>=0) { if (decodePacket.stream_index == videoStreamIndex) { len = avcodec_decode_video2(inStream->codec, decodedFrame, &got_frame, &decodePacket); if(len < 0) exit(1); if(got_frame) { av_init_packet(&encodedPacket); encodedPacket.data = NULL; encodedPacket.size = 0; if(avcodec_encode_video2(outStream->codec, &encodedPacket, decodedFrame, &got_frame) < 0) exit(1); if(got_frame) { if (outStream->codec->coded_frame->key_frame) encodedPacket.flags |= AV_PKT_FLAG_KEY; encodedPacket.stream_index = outStream->index; if(av_interleaved_write_frame(outContainer, &encodedPacket) < 0) exit(1); av_free_packet(&encodedPacket); } } } av_free_packet(&decodePacket); } av_write_trailer(outContainer); avio_close(outContainer->pb); avcodec_free_frame(&encodeFrame); avcodec_free_frame(&decodedFrame); avformat_free_context(outContainer); av_close_input_file(inContainer); return 0; } -
How to enable X264 with thread for Android on Mac OS X ?
3 janvier 2016, par Jerikc XIONGI use the following script to compile x264:
#!/bin/bash # Based on https://github.com/yixia/x264/blob/master/build_android.sh if [ -z "$ANDROID_NDK" ]; then echo "You must define ANDROID_NDK before starting." echo "They must point to your NDK directories.\n" exit 1 fi # Detect OS OS=`uname` HOST_ARCH=`uname -m` export CCACHE=; type ccache >/dev/null 2>&1 && export CCACHE=ccache if [ $OS == 'Linux' ]; then export HOST_SYSTEM=linux-$HOST_ARCH elif [ $OS == 'Darwin' ]; then export HOST_SYSTEM=darwin-$HOST_ARCH fi SOURCE=`pwd` PREFIX=$SOURCE/build/android SYSROOT=$ANDROID_NDK/platforms/android-12/arch-arm CROSS_PREFIX=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/$HOST_SYSTEM/bin/arm-linux-androideabi- EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__" EXTRA_LDFLAGS="-nostdlib" ./configure --prefix=$PREFIX \ --cross-prefix=$CROSS_PREFIX \ --extra-cflags="$EXTRA_CFLAGS" \ --extra-ldflags="$EXTRA_LDFLAGS" \ --enable-pic \ --enable-static \ --enable-strip \ --disable-cli \ --host=arm-linux \ --sysroot=$SYSROOT make clean make STRIP= -j4 install || exit 1
After i add '-lpthread' , i got the following compile error:
$ sh build_android.sh No working C compiler found. Makefile:3: config.mak: No such file or directory ./configure platform: X86_64 byte order: little-endian system: MACOSX cli: yes libx264: internal shared: no static: no asm: yes interlaced: yes avs: avxsynth lavf: no ffms: no mp4: no gpl: yes thread: posix opencl: yes filters: crop select_every debug: no gprof: no strip: no PIC: no bit depth: 8 chroma format: all You can run 'make' or 'make fprofiled' now. dependency file generation... clang: error: no such file or directory: '/common/mc.c' clang: error: no such file or directory: '/common/predict.c' clang: error: no such file or directory: '/common/pixel.c' clang: error: no such file or directory: '/common/macroblock.c' clang: error: no such file or directory: '/common/frame.c' clang: error: no such file or directory: '/common/dct.c' clang: error: no such file or directory: '/common/cpu.c' clang: error: no such file or directory: '/common/cabac.c' clang: error: no such file or directory: '/common/common.c' clang: error: no such file or directory: '/common/osdep.c' clang: error: no such file or directory: '/common/rectangle.c' clang: error: no such file or directory: '/common/set.c' clang: error: no such file or directory: '/common/quant.c' clang: error: no such file or directory: '/common/deblock.c' clang: error: no such file or directory: '/common/vlc.c' clang: error: no such file or directory: '/common/mvpred.c' clang: error: no such file or directory: '/common/bitstream.c' clang: error: no such file or directory: '/encoder/analyse.c' clang: error: no such file or directory: '/encoder/me.c' clang: error: no such file or directory: '/encoder/ratecontrol.c' clang: error: no such file or directory: '/encoder/set.c' clang: error: no such file or directory: '/encoder/macroblock.c' clang: error: no such file or directory: '/encoder/cabac.c' clang: error: no such file or directory: '/encoder/cavlc.c' clang: error: no such file or directory: '/encoder/encoder.c' clang: error: no such file or directory: '/encoder/lookahead.c' clang: error: no such file or directory: '/x264.c' clang: error: no such file or directory: 'x264.o' clang: error: no input files clang: error: no such file or directory: '/input/input.c' clang: error: no such file or directory: 'input/input.o' clang: error: no input files clang: error: no such file or directory: '/input/timecode.c' clang: error: no such file or directory: 'input/timecode.o' clang: error: no input files clang: error: no such file or directory: '/input/raw.c' clang: error: no such file or directory: 'input/raw.o' clang: error: no input files clang: error: no such file or directory: '/input/y4m.c' clang: error: no such file or directory: 'input/y4m.o' clang: error: no input files clang: error: no such file or directory: '/output/raw.c' clang: error: no such file or directory: 'output/raw.o' clang: error: no input files clang: error: no such file or directory: '/output/matroska.c' clang: error: no such file or directory: 'output/matroska.o' clang: error: no input files clang: error: no such file or directory: '/output/matroska_ebml.c' clang: error: no such file or directory: 'output/matroska_ebml.o' clang: error: no input files clang: error: no such file or directory: '/output/flv.c' clang: error: no such file or directory: 'output/flv.o' clang: error: no input files clang: error: no such file or directory: '/output/flv_bytestream.c' clang: error: no such file or directory: 'output/flv_bytestream.o' clang: error: no input files clang: error: no such file or directory: '/filters/filters.c' clang: error: no such file or directory: 'filters/filters.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/video.c' clang: error: no such file or directory: 'filters/video/video.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/source.c' clang: error: no such file or directory: 'filters/video/source.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/internal.c' clang: error: no such file or directory: 'filters/video/internal.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/resize.c' clang: error: no such file or directory: 'filters/video/resize.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/cache.c' clang: error: no such file or directory: 'filters/video/cache.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/fix_vfr_pts.c' clang: error: no such file or directory: 'filters/video/fix_vfr_pts.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/select_every.c' clang: error: no such file or directory: 'filters/video/select_every.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/crop.c' clang: error: no such file or directory: 'filters/video/crop.o' clang: error: no input files clang: error: no such file or directory: '/filters/video/depth.c' clang: error: no such file or directory: 'filters/video/depth.o' clang: error: no input files clang: error: no such file or directory: '/extras/getopt.c' clang: error: no such file or directory: 'extras/getopt.o' clang: error: no input files make: *** [.depend] Error 1
How to enable pthread support?
-
libx264 encode error Input picture width (40) is greater than stride (0)
27 décembre 2015, par alijandroI used libx264 in ffmpeg to encode video, I used the configuration below.
enCodecContext->bit_rate = 300000; enCodecContext->width = 80; enCodecContext->height = 60; enCodecContext->time_base = (AVRational) {1, 25}; enCodecContext->gop_size = 10; enCodecContext->max_b_frames = 1; enCodecContext->pix_fmt = PIX_FMT_YUV420P; enCodecContext->qcompress = 0.6; av_opt_set(enCodecContext->priv_data, "preset", "slow", 0);
But when I called
avcodec_encode_video2
withenCodecContext
, I got the errorInput picture width (40) is greater than stride (0)
.avcodec_encode_video2(enCodecContext, &filteredAVPacket, pFilteredAVFrame, &got_packet_ptr);
The
pFilteredAVFrame->width
andpFilteredAVFrame->height
is80
and60
respectively.Did I missed something when configured
libx264
, How can I get a workable configuration forlibx264
to encode my video? -
Android ffmpeg with libx264 - undefined references
5 décembre 2015, par Krzysztof KansyI'm building ffmpeg for Android with libx264 using appunite's project under Ubuntu 15.10. I've build it without libx264 properly, but adding the library keep giving me
undefined reference to 'x264_picture_init'
and multiple other similar errors. I tried variety of possible solutions from mailing lists/other SO questions, but still nothing helps me solving the problem.I have removed ffmpeg/libx264/libx264-dev packages to avoid possible duplicate libraries in the system. I've got the libx264.a library in ffmpeg-build/ARCH/lib, where the other built libraries lives. Also I don't think this is caused by header file not matching the library, because the only x264.h header in the system is the one used for the library building.
Here is my build_android.sh.
set -x if [ "$ANDROID_NDK_HOME" = "" ]; then echo ANDROID_NDK_HOME variable not set, exiting echo "Use: export ANDROID_NDK_HOME=/your/path/to/android-ndk" exit 1 fi # Get the newest arm-linux-androideabi version if [ -z "$COMPILATOR_VERSION" ]; then DIRECTORIES=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-* for i in $DIRECTORIES; do PROPOSED_NAME=${i#*$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-} if [[ $PROPOSED_NAME =~ ^[0-9\.]+$ ]] ; then echo "Available compilator version: $PROPOSED_NAME" COMPILATOR_VERSION=$PROPOSED_NAME fi done fi if [ -z "$COMPILATOR_VERSION" ]; then echo "Could not find compilator" exit 1 fi if [ ! -d $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION ]; then echo $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION does not exist exit 1 fi echo "Using compilator version: $COMPILATOR_VERSION" OS_ARCH=`basename $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION/prebuilt/*` echo "Using architecture: $OS_ARCH" function setup_paths { export PLATFORM=$ANDROID_NDK_HOME/platforms/$PLATFORM_VERSION/arch-$ARCH/ if [ ! -d $PLATFORM ]; then echo $PLATFORM does not exist exit 1 fi echo "Using platform: $PLATFORM" export PATH=${PATH}:$PREBUILT/bin/ export CROSS_COMPILE=$PREBUILT/bin/$EABIARCH- export CFLAGS=$OPTIMIZE_CFLAGS export CPPFLAGS="$CFLAGS" export CFLAGS="$CFLAGS" export CXXFLAGS="$CFLAGS" export CXX="${CROSS_COMPILE}g++ --sysroot=$PLATFORM" export AS="${CROSS_COMPILE}gcc --sysroot=$PLATFORM" export CC="${CROSS_COMPILE}gcc --sysroot=$PLATFORM" export PKG_CONFIG="${CROSS_COMPILE}pkg-config" export LD="${CROSS_COMPILE}ld" export NM="${CROSS_COMPILE}nm" export STRIP="${CROSS_COMPILE}strip" export RANLIB="${CROSS_COMPILE}ranlib" export AR="${CROSS_COMPILE}ar" export LDFLAGS="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig/ export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ if [ ! -f "${CROSS_COMPILE}gcc" ]; then echo "Gcc does not exists in path: ${CROSS_COMPILE}gcc" exit 1; fi if [ ! -f "${PKG_CONFIG}" ]; then echo "Pkg config does not exists in path: ${PKG_CONFIG} - Probably BUG in NDK but..." set +e SYS_PKG_CONFIG=$(which pkg-config) if [ "$?" -ne 0 ]; then echo "This system does not contain system pkg-config, so we can do anything" exit 1 fi set -e cat > $PKG_CONFIG << EOF #!/bin/bash pkg-config \$* EOF chmod u+x $PKG_CONFIG echo "Because we have local pkg-config we will create it in ${PKG_CONFIG} directory using ${SYS_PKG_CONFIG}" fi } function build_x264 { echo "Starting build x264 for $ARCH" cd x264 ./configure --prefix=$PREFIX --host=$ARCH-linux --enable-static --disable-shared --enable-pic --disable-cli $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED x264 for $ARCH" } function build_amr { echo "Starting build amr for $ARCH" cd vo-amrwbenc ./configure \ --prefix=$PREFIX \ --host=$ARCH-linux \ --disable-dependency-tracking \ --disable-shared \ --enable-static \ --with-pic \ $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED amr for $ARCH" } function build_aac { echo "Starting build aac for $ARCH" cd vo-aacenc ./configure \ --prefix=$PREFIX \ --host=$ARCH-linux \ --disable-dependency-tracking \ --disable-shared \ --enable-static \ --with-pic \ $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED aac for $ARCH" } function build_freetype2 { echo "Starting build freetype2 for $ARCH" cd freetype2 ./configure \ --prefix=$PREFIX \ --host=$ARCH-linux \ --disable-dependency-tracking \ --disable-shared \ --enable-static \ --with-pic \ $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED freetype2 for $ARCH" } function build_ass { echo "Starting build ass for $ARCH" cd libass ./configure \ --prefix=$PREFIX \ --host=$ARCH-linux \ --disable-fontconfig \ --disable-dependency-tracking \ --disable-shared \ --enable-static \ --with-pic \ $ADDITIONAL_CONFIGURE_FLAG make clean make V=1 -j4 install make clean cd .. echo "FINISHED ass for $ARCH" } function build_fribidi { echo "Starting build fribidi for $ARCH" cd fribidi ./configure \ --prefix=$PREFIX \ --host=$ARCH-linux \ --disable-bin \ --disable-dependency-tracking \ --disable-shared \ --enable-static \ --with-pic \ $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED fribidi for $ARCH" } function build_ffmpeg { echo "Starting build ffmpeg for $ARCH" cd ffmpeg ./configure --target-os=linux \ --prefix=$PREFIX \ --enable-cross-compile \ --extra-libs="-lgcc -L$PREFIX/lib/libx264.a" \ --arch=$ARCH \ --cc=$CC \ --cross-prefix=$CROSS_COMPILE \ --nm=$NM \ --sysroot=$PLATFORM \ --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS" \ --disable-shared \ --enable-static \ --enable-runtime-cpudetect \ --pkg-config-flags="--static" \ --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog -L$PREFIX/lib" \ --extra-cflags="-I$PREFIX/include" \ --disable-everything \ --enable-gpl \ --enable-pthreads \ --enable-libass \ --enable-libvo-aacenc \ --enable-libvo-amrwbenc \ --enable-hwaccel=h264_vaapi \ --enable-hwaccel=h264_vaapi \ --enable-hwaccel=h264_dxva2 \ --enable-hwaccel=mpeg4_vaapi \ --enable-libx264 \ --enable-demuxer=mov \ --enable-demuxer=h264 \ --enable-muxer=h264 \ --enable-demuxer=mpegvideo \ --enable-demuxer=h263 \ --enable-demuxer=mpegps \ --enable-demuxer=mjpeg \ --enable-demuxer=rtsp \ --enable-demuxer=rtp \ --enable-demuxer=hls \ --enable-demuxer=matroska \ --enable-muxer=rtsp \ --enable-muxer=mp4 \ --enable-muxer=mov \ --enable-muxer=mjpeg \ --enable-muxer=matroska \ --enable-protocol=crypto \ --enable-protocol=jni \ --enable-protocol=file \ --enable-protocol=rtp \ --enable-protocol=tcp \ --enable-protocol=udp \ --enable-protocol=applehttp \ --enable-protocol=hls \ --enable-protocol=http \ --enable-decoder=xsub \ --enable-decoder=jacosub \ --enable-decoder=dvdsub \ --enable-decoder=dvbsub \ --enable-decoder=subviewer \ --enable-decoder=rawvideo \ --enable-encoder=rawvideo \ --enable-decoder=mjpeg \ --enable-encoder=mjpeg \ --enable-decoder=h263 \ --enable-decoder=mpeg4 \ --enable-encoder=mpeg4 \ --enable-decoder=h264 \ --enable-encoder=h264 \ --enable-decoder=aac \ --enable-encoder=aac \ --enable-parser=h264 \ --enable-encoder=mp2 \ --enable-decoder=mp2 \ --enable-encoder=libvo_amrwbenc \ --enable-decoder=amrwb \ --enable-muxer=mp2 \ --enable-bsfs \ --enable-decoders \ --enable-encoders \ --enable-parsers \ --enable-hwaccels \ --enable-muxers \ --enable-avformat \ --enable-avcodec \ --enable-avresample \ --enable-zlib \ --disable-doc \ --disable-ffplay \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --enable-avfilter \ --disable-avdevice \ --disable-opencl \ --enable-nonfree \ --enable-version3 \ --enable-memalign-hack \ --enable-asm \ $ADDITIONAL_CONFIGURE_FLAG make clean make -j4 install make clean cd .. echo "FINISHED ffmpeg for $ARCH" } function build_one { echo "Starting build one for $ARCH" cd ffmpeg ${LD} -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname $SONAME -shared -nostdlib -Bsymbolic --whole-archive --no-undefined -o $OUT_LIBRARY -lavformat -lavcodec -lavresample -lavutil -lswresample -lavfilter -lass -lfreetype -lfribidi -lswscale -lvo-aacenc -lvo-amrwbenc -lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker -zmuldefs $PREBUILT/lib/gcc/$EABIARCH/$COMPILATOR_VERSION/libgcc.a cd .. echo "FINISHED one for $ARCH" } # enable additional architectures later on #arm v5 #EABIARCH=arm-linux-androideabi #ARCH=arm #CPU=armv5 #OPTIMIZE_CFLAGS="-marm -march=$CPU" #PREFIX=$(pwd)/ffmpeg-build/armeabi #OUT_LIBRARY=$PREFIX/libffmpeg.so #ADDITIONAL_CONFIGURE_FLAG= #SONAME=libffmpeg.so #PREBUILT=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION/prebuilt/$OS_ARCH #PLATFORM_VERSION=android-5 #setup_paths #build_amr #build_aac #build_fribidi #build_freetype2 #build_ass #build_ffmpeg #build_one #x86 #EABIARCH=i686-linux-android #ARCH=x86 #OPTIMIZE_CFLAGS="-m32" #PREFIX=$(pwd)/ffmpeg-build/x86 #OUT_LIBRARY=$PREFIX/libffmpeg.so #ADDITIONAL_CONFIGURE_FLAG=--disable-asm #SONAME=libffmpeg.so #PREBUILT=$ANDROID_NDK_HOME/toolchains/x86-$COMPILATOR_VERSION/prebuilt/$OS_ARCH #PLATFORM_VERSION=android-9 #setup_paths #build_amr #build_aac #build_fribidi #build_freetype2 #build_ass #build_ffmpeg #build_one #mips #EABIARCH=mipsel-linux-android #ARCH=mips #OPTIMIZE_CFLAGS="-EL -march=mips32 -mips32 -mhard-float" #PREFIX=$(pwd)/ffmpeg-build/mips #OUT_LIBRARY=$PREFIX/libffmpeg.so #ADDITIONAL_CONFIGURE_FLAG="--disable-mips32r2" #SONAME=libffmpeg.so #PREBUILT=$ANDROID_NDK_HOME/toolchains/mipsel-linux-android-$COMPILATOR_VERSION/prebuilt/$OS_ARCH #PLATFORM_VERSION=android-9 #setup_paths #build_amr #build_aac #build_fribidi #build_freetype2 #build_ass #build_ffmpeg #build_one #arm v7vfpv3 EABIARCH=arm-linux-androideabi ARCH=arm CPU=armv7-a OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU " PREFIX=$(pwd)/ffmpeg-build/armeabi-v7a OUT_LIBRARY=$PREFIX/libffmpeg.so ADDITIONAL_CONFIGURE_FLAG= SONAME=libffmpeg.so PREBUILT=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION/prebuilt/$OS_ARCH PLATFORM_VERSION=android-5 setup_paths build_x264 build_amr build_aac build_fribidi build_freetype2 build_ass build_ffmpeg build_one #arm v7 + neon (neon also include vfpv3-32) EABIARCH=arm-linux-androideabi ARCH=arm CPU=armv7-a OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8 -mthumb -D__thumb__ " PREFIX=$(pwd)/ffmpeg-build/armeabi-v7a-neon OUT_LIBRARY=../ffmpeg-build/armeabi-v7a/libffmpeg-neon.so ADDITIONAL_CONFIGURE_FLAG=--enable-neon SONAME=libffmpeg-neon.so PREBUILT=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-$COMPILATOR_VERSION/prebuilt/$OS_ARCH PLATFORM_VERSION=android-9 setup_paths build_x264 build_amr build_aac build_fribidi build_freetype2 build_ass build_ffmpeg build_one echo "BUILD SUCCESS"
I've disabled the non-arm architectures for the time being. If there is any other information I can provide to help finding the problem, I will be happy to do so.
I'm wondering if the issue may be caused by something missing in the script, namely in build_one part, tho I tried to indicate the libx264.a directly in --extra-ldflags, without success.
-
webm to mp4 conversion using ffmpeg
2 décembre 2015, par Pavan KWhen I try to convert a webm file to mp4 the output is very very choppy and it appears as if many frames have been dropped by ffmpeg
I used the following commands to convert
ffmpeg -i movie.webm movie.mp4 ffmpeg -i movie.webm -vcodec libx264 movie.mp4 ffmpeg -i movie.webm -vcodec libx264 -qscale 0 movie.mp4
All of them have the same problem. When I use ffprobe it seems to show the frames more or less properly.
UPDATE:
built on Jun 14 2013 14:31:50 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1) configuration: --prefix=/home/user2/ffmpeg_build --extra-cflags=-I/home/user2/ffmpeg_build/include --extra-ldflags=-L/home/pavan4/ffmpeg_build/lib --bindir=/home/pavan4/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab libavutil 52. 35.101 / 52. 35.101 libavcodec 55. 16.100 / 55. 16.100 libavformat 55. 8.102 / 55. 8.102 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 77.101 / 3. 77.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg' Input #0, matroska,webm, from '1.webm': Duration: 00:00:10.64, start: 0.000000, bitrate: 5024 kb/s Stream #0:0(eng): Video: vp8, yuv420p, 1280x720, SAR 1:1 DAR 16:9, 1k fps, 1k tbr, 1k tbn, 1k tbc (default) [libx264 @ 0x1d966a0] using SAR=1/1 [libx264 @ 0x1d966a0] MB rate (3600000) > level limit (2073600) [libx264 @ 0x1d966a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 [libx264 @ 0x1d966a0] profile High, level 5.2 [libx264 @ 0x1d966a0] 264 - core 133 r2 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=-2 threads=12 lookahead_threads=2 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=25 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 '1_conv4.mp4': Metadata: encoder : Lavf55.8.102 Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 16k tbn, 1k tbc (default) Stream mapping: Stream #0:0 -> #0:0 (vp8 -> libx264) Press [q] to stop, [?] for help frame= 168 fps=0.0 q=33.0 size= 62kB time=00:00:00.11 bitrate=4606.0kbits/frame= 293 fps=230 q=33.0 size= 138kB time=00:00:00.23 bitrate=4809.7kbits/ video:5620kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.212461% [libx264 @ 0x1d966a0] frame I:46 Avg QP:18.50 size: 39849 [libx264 @ 0x1d966a0] frame P:2940 Avg QP:18.27 size: 1222 [libx264 @ 0x1d966a0] frame B:7651 Avg QP:17.68 size: 43 [libx264 @ 0x1d966a0] consecutive B-frames: 4.0% 0.2% 0.3% 95.5% [libx264 @ 0x1d966a0] mb I I16..4: 19.9% 63.2% 16.9% [libx264 @ 0x1d966a0] mb P I16..4: 0.2% 0.5% 0.1% P16..4: 3.9% 1.1% 0.6% 0.0% 0.0% skip:93.6% [libx264 @ 0x1d966a0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0:25.1% L1:74.9% BI: 0.0% [libx264 @ 0x1d966a0] 8x8 transform intra:63.6% inter:75.9% [libx264 @ 0x1d966a0] coded y,uvDC,uvAC intra: 61.5% 53.4% 24.4% inter: 0.5% 0.5% 0.0% [libx264 @ 0x1d966a0] i16 v,h,dc,p: 52% 19% 19% 11% [libx264 @ 0x1d966a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 17% 13% 4% 6% 9% 5% 8% 6% [libx264 @ 0x1d966a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 14% 5% 8% 10% 6% 6% 3% [libx264 @ 0x1d966a0] i8c dc,h,v,p: 55% 17% 24% 4% [libx264 @ 0x1d966a0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x1d966a0] ref P L0: 82.5% 13.2% 4.0% 0.3% [libx264 @ 0x1d966a0] ref B L0: 60.2% 39.2% 0.6% [libx264 @ 0x1d966a0] ref B L1: 98.5% 1.5% [libx264 @ 0x1d966a0] kb/s:4327.77