Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
Streaming x264 with packet loss
6 octobre 2014, par user2629511I write the program where I use x264 as the coder. I use the following parameters:
av_opt_set (codecContextH264[numberCoder]-> priv_data, "profile", "baseline", 0); av_opt_set (codecContextH264[numberCoder]-> priv_data, "preset", "ultrafast", 0); av_opt_set (codecContextH264[numberCoder]-> priv_data, "tune", "zerolatency", 0); codecContextH264[numberCoder]-> bit_rate =bitrate; codecContextH264[numberCoder]-> bit_rate_tolerance=bitrate-5000; codecContextH264[numberCoder]-> width = w; codecContextH264[numberCoder]-> height = h; codecContextH264[numberCoder]-> time_base.den = fps; codecContextH264[numberCoder]-> time_base.num = 1; codecContextH264[numberCoder]-> pix_fmt = PIX_FMT_YUV420P; codecContextH264[numberCoder]-> gop_size = fps*3; codecContextH264[numberCoder]-> keyint_min = fps*3; codecContextH264[numberCoder]-> max_b_frames = 0; codecContextH264[numberCoder]-> slices = (int) (w*h)/1500+1;
I use only I and P frames. What x264 settings I shall use that could lose P frames? Perhaps x264 has no such opportunity?! I read that if to use a "base" profile, it is possible to lose P frames... Help please.
-
x264 encoding frame rate limit
30 septembre 2014, par JamesI'm using the following parameters to encode a .mp4 video using the x264 lib:
int fps = 30; x264_param_default_preset(&x.params, "ultrafast", "stillimage,zerolatency"); x.params.i_threads = 1; x.params.i_fps_num = fps; x.params.i_fps_den = 1; x.params.i_timebase_num = 1; x.params.i_timebase_den = fps;
If I set fps to be equal to 25 or less the video encodes in the correct frame rate, however if I try to encode over 25 fps, the frame rate is reduced to 25 fps.
here is a log output, note there are two videos being encoded at the same time:
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX x264 [info]: profile Constrained Baseline, level 4.0 x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX x264 [info]: profile Constrained Baseline, level 4.0 x264 [info]: frame I:2 Avg QP:20.50 size:401756 x264 [info]: frame P:318 Avg QP:24.04 size: 87631 x264 [info]: mb I I16..4: 100.0% 0.0% 0.0% x264 [info]: mb P I16..4: 2.5% 0.0% 0.0% P16..4: 73.3% 0.0% 0.0% 0.0% 0.0% skip:24.2% x264 [info]: coded y,uvDC,uvAC intra: 50.6% 59.2% 15.8% inter: 40.1% 21.6% 0.2% x264 [info]: i16 v,h,dc,p: 14% 34% 40% 12% x264 [info]: i8c dc,h,v,p: 39% 28% 19% 13% x264 [info]: kb/s:21502.55 x264 [info]: frame I:2 Avg QP:20.50 size:380898 x264 [info]: frame P:318 Avg QP:24.01 size: 82754 x264 [info]: mb I I16..4: 100.0% 0.0% 0.0% x264 [info]: mb P I16..4: 2.5% 0.0% 0.0% P16..4: 73.1% 0.0% 0.0% 0.0% 0.0% skip:24.4% x264 [info]: coded y,uvDC,uvAC intra: 50.0% 56.0% 14.9% inter: 38.4% 21.8% 0.2% x264 [info]: i16 v,h,dc,p: 14% 34% 40% 12% x264 [info]: i8c dc,h,v,p: 39% 29% 19% 13% x264 [info]: kb/s:20308.27
-
h264 lossless coding
29 septembre 2014, par cloudravenIs it possible to do completely lossless encoding in h264? By lossless, I mean that if I feed it a series of frames and encode them, and then if I extract all the frames from the encoded video, I will get the exact same frames as in the input, pixel by pixel, frame by frame. Is that actually possible? Take this example:
I generate a bunch of frames, then I encode the image sequence to an uncompressed AVI (with something like virtualdub), I then apply lossless h264 (the help files claim that setting --qp 0 makes lossless compression, but I am not sure if that means that there is no loss at any point of the process or that just the quantization is lossless). I can then extract the frames from the resulting h264 video with something like mplayer.
I tried with Handbrake first, but it turns out it doesn't support lossless encoding. I tried x264 but it crashes. It may be because my source AVI file is in RGB colorspace instead of YV12. I don't know how to feed a series of YV12 bitmaps and in what format to x264 anyway, so I cannot even try.
In summary what I want to know if that is there a way to go from
Series of lossless bitmaps (in any colorspace) -> some transformation -> h264 encode -> h264 decode -> some transformation -> the original series of lossless bitmaps
If there a way to achieve this?
EDIT: There is a VERY valid point about lossless H264 not making too much sense. I am well aware that there is no way I could tell (with just my eyes) the difference between and uncompressed clip and another compressed at a high rate in H264, but I don't think it is not without uses. For example, it may be useful for storing video for editing without taking huge amounts of space and not losing quality and spending too much encoding time every time the file is saved.
UPDATE 2: Now x264 doesn't crash. I can use as sources either avisynth or lossless yv12 lagarith (to avoid the colorspace compression warning). Howerver, even with --qp 0 and a rgb or yv12 source I still get some differences, minimal but present. This is troubling, because all the information I have found on lossless predictive coding (--qp 0) claims that the whole encoding should be lossless, but I am unable to verifiy this.
-
FFMPEG x264 encoder Android
24 septembre 2014, par DundeeDaveI've compiled an FFMPEG library for use on Android with libx264 and using the NDK.
I want to encode an MPEG video file however the application is failing when opening the encoder codec, in avcodec_open2.
The FFMPEG logs I receive from avcodec_open2 are below with the function returning -22.
- Picture size %ux%u is invalid.
- ignoring invalid width/height values
- Specified pix_fmt is not supported
On windows this code works fine, it's only on Android that there is a failure. Any ides why this would fail on Android?
if (!(codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO))) { return -1; } //Allocate context based on codec if (!(context = avcodec_alloc_context3(codec))) { return -2; } //Setup Context // put sample parameters context->bit_rate = 4000000; // resolution must be a multiple of two context->width = 1280; context->height = 720; // frames per second context->time_base = (AVRational){1,25}; context->inter_quant_bias = 96; context->gop_size = 10; context->max_b_frames = 1; //IDs context->pix_fmt = AV_PIX_FMT_YUV420P; context->codec_id = AV_CODEC_ID_MPEG1VIDEO; context->codec_type = AVMEDIA_TYPE_VIDEO; if (AV_CODEC_ID_MPEG1VIDEO == AV_CODEC_ID_H264) { av_opt_set(context->priv_data, "preset", "slow", 0); } if ((result = avcodec_open2(context, codec, NULL)) < 0) { //Failed opening Codec! }
-
Create video from series of images using android
15 septembre 2014, par Farrakh JavedI'm trying to write an android application in which we allow user to create video from series of images. I did lot of investigation like C/C++ libraries FFMPEG, X264. These can be used using NDK, but i dont know how to use it via NDK, i also did investigation but did not get about this. I find another library JCodec It is java based. I tried different codes of JCodec but did not get any success. Below are Links related to JCodec:
Now can anyone guide me about this question and can i have some suggestion how to implement this feature.