Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
x264_coeff_last64_sse2
16 décembre 2011, par mooseThe x264 lib is crashing on Windows as always. Now, I'm trying to fix it, and I don't understand one thing. In the code we can see only the function signature:
int x264_coeff_last64_sse2( dctcoef *dct );
But, there is no implementation in *.h, *.c or *.asm source. How is that possible???
(The function is called and it crashed, so it has to be linked in)
-
YUY2 image ==>>sws_scale ==>>x264_encoder_encode doesn't work in Windows
8 décembre 2011, par shiju sasiI have a multi media app in Windows using x264 built using MSYS-MingW and ffmpeg Windows binaries. This works for most of the cameras which capture data in RGB24 and RGB32 formats in most of the OSes. But when I tested the app on a Windows 7 (64 bit OS) Sony Vaio Laptop which has an integrated webcam capturing in YUY2 format, the x264_enoder_encode crashes. The sws_scale to convert the YUY2 data to YUV420 Planar any way works fine here too and returns proper stride values. Please check the relevant code fragments that I have attached below.
x264_param_apply_profile(&m_param, "baseline"); m_pEncoder = x264_encoder_open(&m_param); x264_encoder_parameters(m_pEncoder,&m_param); m_encoderConvertCtx = sws_getContext(g_iWidth, g_iHeight, PIX_FMT_YUYV422, SCALE_WIDTH, SCALE_HEIGHT, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); x264_picture_t m_pic_in, m_pic_out; //X264 picture variables to get the X264 encoded picture out. x264_picture_init(&m_pic_in); m_pic_in.i_type = X264_CSP_I420; x264_nal_t* m_nals; srcstride = g_iWidth * 2; //For YUYV422 Packed AVFrame* pictIn; AVFrame* pictOut; int iInBytes = avpicture_get_size(PIX_FMT_YUV420P, SCALE_WIDTH, SCALE_HEIGHT); uint8_t* outbuffer = (uint8_t*)av_malloc(iInBytes); pictOut = avcodec_alloc_frame(); avpicture_fill((AVPicture*)pictOut, outbuffer, PIX_FMT_YUV420P, SCALE_WIDTH, SCALE_HEIGHT); sws_scale(m_encoderConvertCtx, &in_buf, &srcstride, 0, g_iHeight, pictOut->data, pictOut->linesize); //Scale from YUYV422 Packed to YUV420 Plane ///Code after Scale begins memcpy(m_pic_in.img.plane[0],pictOut->data[0],SCALE_WIDTH * SCALE_HEIGHT); memcpy(m_pic_in.img.plane[1],pictOut->data[1],SCALE_WIDTH * SCALE_HEIGHT/4); memcpy(m_pic_in.img.plane[2],pictOut->data[2],SCALE_WIDTH * SCALE_HEIGHT/4); m_pic_in.img.plane[3] = 0; for(int iPlane = 0; iPlane < 3; iPlane++) { m_pic_in.img.i_stride[iPlane] = pictOut->linesize[iPlane]; } m_pic_in.img.i_stride[3] = 0; int frame_size = x264_encoder_encode(m_pEncoder, &m_nals, &i_nals, &m_pic_in, &m_pic_out);
Please help if possible, as this has been consuming a lot of time at my end. But I am not able to dig in to the library side for debugging. Any experienced hands are requested to assist.
-
compressing an RGB framebuffer with libxvidcore library
6 décembre 2011, par heviI want to compress a framebuffer (or any RGB raw image data) instance and compress it using xvid codec (actually any other compression library is also welcome especially libx264).
I successfully get the framebuffer data from a game I developed for myself which actually is a byte array of size 3(for RGB channels) x width x height. I also downloaded and compiled libxvidcore. However I have no idea how to compress the framebuffer using libxvidcore library. I googled for examples but couldn't find what I need.
any helps are welcome!
-
Theatrical quality ffmpeg/x264 encoding of a high-motion 1080p video
2 décembre 2011, par IanI've been struggling with encoding videos using FFMPEG and x264. The output stutters when played back in Quicktime, while in VLC it shows a lot of compression artifacts at the same places Quicktime stutters. So it seems like Quicktime is stuttering because it's trying to suppress the corruption/artifacts.
The videos have a lot of random motion in them, including frames where 75% of the pixels will change at a random interval (the video is software generated so it's truly pseudo-random). The compression seems to be choking in these places where it's likely detecting a "scene cut" incorrectly. It also seems to choke at regular intervals where I guess it's doing a keyframe.
I've based my encoding preset off of the x264-hq preset that comes with FFMPEG. I've tried turning off scene cut detection, and playing with the
keyint
/g
andkeyint_min
options. Settingg
to 1 makes it work, but blows out the filesize. I've tried the lossless presets, but they won't playback at all in Quicktime. Oddly, I haven't had any problems when working with a lower-resolution test video (1440x810).Here's the preset I have right now, which works, but yields a file that's approximately 60% larger than the (non-working) hq preset yields. Is there any way to improve upon this? The filesize doesn't matter much, I just want something that will playback anywhere and be very high quality.
coder=1 flags=+loop cmp=+chroma partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 me_method=umh subq=8 me_range=16 g=1 keyint_min=1 sc_threshold=0 i_qfactor=0.71 b_strategy=1crf=20 qcomp=0.6 qmin=20 qmax=51 qdiff=4 bf=16 refs=4 trellis=1 flags2=+dct8x8+wpred+bpyramid+mixed_refs wpredp=2
Here's the command:
ffmpeg \ -r 60 -i "frame-%06d.tiff" \ -vcodec libx264 -vpre my_preset \ -threads 0 \ -r 60 -an -f out.mp4
-
How to encode a picture into H264 using x264 API ?
23 novembre 2011, par cmm427I encode a picture following the link How to encode series of images into H264 using x264 API? (C/C++), but every time x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out) returns 0.