Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
Make images to video using FFMPEG on android not working
6 mars 2015, par SalmaanI built ffmpeg 2.5.4 with libx264 and am using these commands but they are giving error...
On previous version of ffmpeg they were working fine...Here is the command i am using to convert images to video
String[] ffmpegCommand = { "/data/data/uk.org.humanfocus.hfi/ffmpeg", "-r", Fps, "-i", Environment.getExternalStorageDirectory().getPath() + "/HumanFocus/MarkerFrame/frame%05d.jpg", "-qscale", "0", mFilePathMarker };
Here is my ffmpeg Log
03-06 10:00:12.579: V/asd(10011): ***Input #0, image2, from '/storage/emulated/0/HumanFocus/MarkerFrame/frame%05d.jpg':*** 03-06 10:00:12.579: V/asd(10011): *** Duration: 00:00:02.32, start: 0.000000, bitrate: N/A*** 03-06 10:00:12.584: V/asd(10011): *** Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1279x719 [SAR 1:1 DAR 1279:719], 25 fps, 25 tbr, 25 tbn, 25 tbc*** 03-06 10:00:12.584: V/asd(10011): ***Please use -q:a or -q:v, -qscale is ambiguous*** 03-06 10:00:12.589: V/asd(10011): ***No pixel format specified, yuvj420p for H.264 encoding chosen.*** 03-06 10:00:12.589: V/asd(10011): ***Use -pix_fmt yuv420p for compatibility with outdated media players.*** 03-06 10:00:12.594: V/asd(10011): ***[libx264 @ 0x52e80] width not divisible by 2 (1279x719)*** 03-06 10:00:12.594: V/asd(10011): ***Output #0, mp4, to '/storage/emulated/0/HumanFocus/WPOvideos/TEMP/20150306050004.mp4':*** 03-06 10:00:12.594: V/asd(10011): *** Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 11.40 fps*** 03-06 10:00:12.594: V/asd(10011): *** Metadata:*** 03-06 10:00:12.594: V/asd(10011): *** encoder : Lavc56.13.100 libx264*** 03-06 10:00:12.594: V/asd(10011): ***Stream mapping:*** 03-06 10:00:12.594: V/asd(10011): *** Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))*** 03-06 10:00:12.594: V/asd(10011): ***Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height***
Please help me out...
Where is the issue? -
Android Error While Using FFMPEG Commands - error while opening encoder for output stream - maybe incorrect parameters such as bit_rate etc
5 mars 2015, par Arslan AhmadI compiled ffmpeg with libx264 on linux and now when i am running this command
String[] ffmpegCommandImages = { "/data/data/uk.org.humanfocus.hfi/ffmpeg", "-i", videoPath, "-b:v", "1000k", "-vf", "scale=-1:576", "-c:a", "copy", "-c:v", "libx264", "-threads", "12", "-b:a", "196k", to };
This is the error I get, posted the log...
Please help me out.***Starting FFMPEG*** ***ffmpeg version 2.5.4 Copyright (c) 2000-2015 the FFmpeg developers*** *** built on Mar 5 2015 19:02:01 with gcc 4.8 (GCC)*** V/asd(26115): *** configuration: --prefix=/home/hfi/Downloads/android-ndk-r10d/sources/ffmpeg-2.5.4/android/arm --enable-shared --disable-static --disable-doc --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-doc --disable-symver --cross-prefix=/home/hfi/Downloads/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --target-os=linux --arch=arm --enable-cross-compile --enable-libx264 --enable-gpl --sysroot=/home/hfi/Downloads/android-ndk-r10d/platforms/android-9/arch-arm --extra-cflags='-Os -fpic -I /usr/local/include -marm' --extra-ldflags=' -L /usr/local/lib '*** *** libavutil 54. 15.100 / 54. 15.100*** *** libavcodec 56. 13.100 / 56. 13.100*** *** libavformat 56. 15.102 / 56. 15.102*** *** libavfilter 5. 2.103 / 5. 2.103*** *** libswscale 3. 1.101 / 3. 1.101*** *** libswresample 1. 1.100 / 1. 1.100*** *** libpostproc 53. 3.100 / 53. 3.100*** E/Runnable(26115): CAlled V/asd(26115): ***Input #0, image2, from '/storage/emulated/0/HumanFocus/MarkerFrame/frame%05d.jpg':*** V/asd(26115): *** Duration: 00:00:01.76, start: 0.000000, bitrate: N/A*** V/asd(26115): *** Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1279x719 [SAR 1:1 DAR 1279:719], 25 fps, 25 tbr, 25 tbn, 25 tbc*** V/asd(26115): ***Please use -q:a or -q:v, -qscale is ambiguous*** V/asd(26115): ***No pixel format specified, yuvj420p for H.264 encoding chosen.*** V/asd(26115): ***Use -pix_fmt yuv420p for compatibility with outdated media players.*** V/asd(26115): ***[libx264 @ 0x52e80] width not divisible by 2 (1279x719)*** V/asd(26115): ***Output #0, mp4, to '/storage/emulated/0/HumanFocus/WPOvideos/TEMP/20150305144005.mp4':*** V/asd(26115): *** Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 11 fps*** V/asd(26115): *** Metadata:*** V/asd(26115): *** encoder : Lavc56.13.100 libx264*** V/asd(26115): ***Stream mapping:*** V/asd(26115): *** Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))*** V/asd(26115): ***Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height*** V/asdas(26115): ***Ending FFMPEG***
-
compile ffmpeg with libx264 for android
5 mars 2015, par Arslan AhmadWhat is wrong with the libx264 path please anyone help me? I have compiled libx264 latest source code. When I compiled the ffmpeg source using below x264 path . It wont allow me to record video. Note that: I am compiling libraries by linux
#!/bin/bash ###################################################### # Usage: # put this script in top of FFmpeg source tree # ./build_android # It generates binary for following architectures: # ARMv6 # ARMv6+VFP # ARMv7+VFM-ïd16 (Tegra2) # ARMv7+Neon (Cortex-A8) # Customizing: # 1. Feel free to change ./configure parameters for more features # 2. To adapt other ARM variants # set $CPU and $OPTIMIZE_CFLAGS # call build_one ###################################################### HOME=/home NDK=$HOME/hfi/Downloads/android-ndk-r10d PLATFORM=$NDK/platforms/android-9/arch-arm SYSROOT=$PLATFORM PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 TOOLCHAIN=$PREBUILT function build_one { ./configure \ --prefix=$PREFIX \ --enable-shared \ --enable-nonfree \ --enable-gpl \ --enable-libx264 \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-avdevice \ --disable-doc \ --disable-symver \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --target-os=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -I /usr/local/include +-fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ $ADDITIONAL_CONFIGURE_FLAG make clean make make install } CPU=arm PREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm" build_one
-
libx264 bitrate to high for streaming
26 février 2015, par KevinAI'm using libx264 to encode video captured at 1080p 24fps from a video camera. The output of the encoder goes to Live555 for streaming. I cannot get the bitrate below 30 mb/s.
My Current Settings for x264 are:
if (x264_param_default_preset(&m_pParam, "ultrafast", "zerolatency") != 0){ return false; } int fps = 24; m_pParam.i_threads = 1; m_pParam.i_fps_num = fps; m_pParam.i_fps_den = 1; m_pParam.i_width = m_iWidthOut; m_pParam.i_height = m_iHeightOut; // One keyframe per X frames: m_pParam.i_keyint_max = 60; //Rate control: m_pParam.rc.i_rc_method = X264_RC_CRF; m_pParam.rc.f_rf_constant = fps - 5; m_pParam.rc.f_rf_constant_max = fps + 5; //m_pParam.i_sps_id = 7; //For streaming: m_pParam.b_repeat_headers = 1; m_pParam.b_annexb = 1; m_pParam.b_intra_refresh = 1; if (x264_param_apply_profile(&m_pParam, "main") != 0) { return false; } return true;
Changing the preset seems to only slow the encoding rate and consequently the frame rate.
How can I get the bitrate below 30mb/s so I can stream to something like a phone?
-
Confused about x264 and encoding video frames
26 février 2015, par spartygwI built a test driver for encoding a series of images I have captured. I am using libx264 and based my driver off of this guy's answer:
In my case I am starting out by reading in a JPG image and converting to YUV and passing that same frame over and over in a loop to the x264 encoder.
My expectation was that since the frame is the same that the output from the encoder would be very small and constant.
Instead I find that the NAL payload is varied from a few bytes to a few KB and also varies highly depending on the frame rate I specify in the encoder parameters.
Obviously I don't understand video encoding. Why does the output size vary so much?
int main() { Image image(WIDTH, HEIGHT); image.FromJpeg("frame-1.jpg"); unsigned char *data = image.GetRGB(); x264_param_t param; x264_param_default_preset(¶m, "fast", "zerolatency"); param.i_threads = 1; param.i_width = WIDTH; param.i_height = HEIGHT; param.i_fps_num = FPS; param.i_fps_den = 1; // Intra refres: param.i_keyint_max = FPS; param.b_intra_refresh = 1; //Rate control: param.rc.i_rc_method = X264_RC_CRF; param.rc.f_rf_constant = FPS-5; param.rc.f_rf_constant_max = FPS+5; //For streaming: param.b_repeat_headers = 1; param.b_annexb = 1; x264_param_apply_profile(¶m, "baseline"); // initialize the encoder x264_t* encoder = x264_encoder_open(¶m); x264_picture_t pic_in, pic_out; x264_picture_alloc(&pic_in, X264_CSP_I420, WIDTH, HEIGHT); // X264 expects YUV420P data use libswscale // (from ffmpeg) to convert images to the right format struct SwsContext* convertCtx = sws_getContext(WIDTH, HEIGHT, PIX_FMT_RGB24, WIDTH, HEIGHT, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); // encoding is as simple as this then, for each frame do: // data is a pointer to your RGB structure int srcstride = WIDTH*3; //RGB stride is just 3*width sws_scale(convertCtx, &data, &srcstride, 0, HEIGHT, pic_in.img.plane, pic_in.img.i_stride); x264_nal_t* nals; int i_nals; int frame_size = x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out); int max_loop=15; int this_loop=1; while (frame_size >= 0 && --max_loop) { cout << "------------" << this_loop++ << "-----------------\n"; cout << "Frame size = " << frame_size << endl; cout << "output has " << pic_out.img.i_csp << " colorspace\n"; cout << "output has " << pic_out.img.i_plane << " # img planes\n"; cout << "i_nals = " << i_nals << endl; for (int n=0; n