Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
equivalent of QImage::bits() in C/C++
17 février 2012, par JonnyCplusplusI am having an issue using ffmpeg. ffmpeg expects to read in a uint8_t and QImage::bits() is the only way I can generate valid images to feed to ffmpeg to get a valid video. The function ffmpeg(buf) will essentially generate the video I need. The issue is the buffers in each example print out very different results.
My goad is to get the same result I get with QImage::bits() without using Qt at all. How can I duplicate that using C/C++
Works:
QImage getInfo("image"); uint8_t *buf = getInfo.bits(); ffmpeg(buff); // this will work great!
This does not work:
FILE *f; long lSize=0; uint8_t *buf; f = fopen ("image", "rb"); fseek (f , 0 , SEEK_END); lSize = ftell (f); rewind (f); buf = (uint8_t*)malloc(lSize); fread (buf, 1, lSize, f); ffmpeg(buf); //junk video!
-
video frames render slow using opengl and ffmpeg in iphone
17 février 2012, par resident_I'm developing an video player for iPhone. I'm using ffmpeg libraries to decode frames of video and I'm using opengl 2.0 to render the frames to the screen.
But my app is very slow render the frames and some videos played slowly.
I have played AVI, MOV, FLV, MP4 and WMV, and only several AVI files are correct played.
I don't have much idea of ffmpeg and opengl, and I have used a tutorials and examples until now. But I think that the problem can be two things:
The render method is very slowly. I don't use correctly the glTexSubImage2D function.
I don't scale the frames correctly. I don't use correctly the sws_getContext function.
I'm here parts of my code, to see if anyone can help me.
So I use sws_getContext
ctx->p_sws_ctx = sws_getContext(ctx->p_video_ctx->width, ctx->p_video_ctx->height, ctx->p_video_ctx->pix_fmt, ctx->p_video_ctx->width, ctx->p_video_ctx->height, PIX_FMT_RGB565, SWS_FAST_BILINEAR, NULL, NULL, NULL); // Framebuffer for RGB data ctx->p_frame_buffer = malloc(avpicture_get_size(PIX_FMT_RGB565, ctx->p_video_ctx->width, ctx->p_video_ctx->height)); avpicture_fill((AVPicture*)ctx->p_picture_rgb, ctx->p_frame_buffer, PIX_FMT_RGB565, ctx->p_video_ctx->width, ctx->p_video_ctx->height);
My render method of opengl 2.0
- (void) render: (uint8_t*) buffer
{ [EAGLContext setCurrentContext:context];
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer); glViewport(0, 0, backingWidth, backingHeight); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // OpenGL loads textures lazily so accessing the buffer is deferred until draw; notify // the movie player that we're done with the texture after glDrawArrays. glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mFrameW, mFrameH, GL_RGB,GL_UNSIGNED_SHORT_5_6_5, buffer); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); [moviePlayerDelegate bufferDone]; glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer); [context presentRenderbuffer:GL_RENDERBUFFER];
}
Someone, can I Help me?
Thanks,
-
compile opencv2.3.1 in ubuntu 11.10
17 février 2012, par kyonHere is the tutorial I followed:http://thebitbangtheory.wordpress.com/2011/10/23/how-to-install-opencv-2-3-1-in-ubuntu-11-10-oneiric-ocelot-with-python-support/
I think the problem is ffmpeg, the version I used is 0.8.10, and I installed it in /usr and enabled share, but when I complied opencv,the output was full of./../lib/libopencv_highgui.so.2.3.1: undefined reference to
av_codec_get_id' ../../lib/libopencv_highgui.so.2.3.1: undefined reference to
av_seek_frame'
../../lib/libopencv_highgui.so.2.3.1: undefined reference to `avpicture_get_size -
How can I use ffmpeg avfilter without undefined reference
17 février 2012, par HimikoI want to use the filters provided by ffmepeg in my own program to deal with the videos. And based on the sample provided in the file example of the usage of the filters, I changed into jni method, then compile it using android NDK r7, but there are many undefined reference errors while compiling, all from filters. I am sure that I include the needed headers and compiled the ffmpeg.so with
--enable-avfilter
I use
System.loadLibrary("ffmpeg");
and the Android.mk is like this
LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) PATH_TO_FFMPEG_SOURCE:=$(LOCAL_PATH)/ffmpeg LOCAL_C_INCLUDES += $(PATH_TO_FFMPEG_SOURCE) LOCAL_SHARED_LIBRARIES := -lffmpeg LOCAL_LDLIBS := -lffmpeg -lm -lz -ldl LOCAL_MODULE := hello-jni LOCAL_SRC_FILES := hello-jni.c include $(BUILD_SHARED_LIBRARY) include $(LOCAL_PATH)/prebuilt/Android.mk
I use prebuilt methods. Here are the errors I use ndk-build
D:\Code\Android\hello-jni/jni/hello-jni.c:73: undefined reference to
avfilter_get_by_name' D:\Code\Android\hello-jni/jni/hello-jni.c:74: undefined reference to
avfilter_get_by_name' D:\Code\Android\hello-jni/jni/hello-jni.c:75: undefined reference toavfilter_inout_alloc' D:\Code\Android\hello-jni/jni/hello-jni.c:76: undefined reference to
avfilter_inout_alloc' D:\Code\Android\hello-jni/jni/hello-jni.c:83: undefined reference toavfilter_graph_create_filter' D:\Code\Android\hello-jni/jni/hello-jni.c:90: undefined reference to
avfilter_graph_create_filter' D:\Code\Android\hello-jni/jni/hello-jni.c:108: undefined reference toavfilter_graph_parse' D:\Code\Android\hello-jni/jni/hello-jni.c:111: undefined reference to
avfilter_graph_config' ./obj/local/armeabi/objs/hello-jni/hello-jni.o: In functioncropFile': D:\Code\Android\hello-jni/jni/hello-jni.c:200: undefined reference to
avfilter_graph_free' -
illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries
17 février 2012, par OlegI'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:
ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386
I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend. One more thing: my libav* libraries are fat binaries (i386 + x86_64).
Any ideas what can it be?