Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
In ffmpeg, is there a way to tell if the video clip is upside down ?
27 novembre 2012, par DavidBasically, I'd like to get some kind of output when processing a clip with ffmpeg to see weither or not the video is upside down.
Thanks.
-
Decode AAC to PCM with ffmpeg on android
26 novembre 2012, par JeffGI have built ffmpeg 0.8.12 (love) with the android NDK (r8c) on ubuntu. I then use the generated library in another android application through JNI.
Essentially what I want to do is pass a byte stream from java to my c jni function and use ffmpeg to decode it into a PCM audio buffer which will then be passed back to java to be played using Android's AudioTrack. I can successfully pass the buffer through to jni (have checked the values) and ffmpeg seems to initialise correctly, but when it tries to decode the first frame, it throws an error in the aac_decode_frame_int method in aacdec.c "channel element 0.0 is not allocated". The aac file plays fine and is valid.
Here is my jni code to do the decoding
jint Java_com_example_testffmpeg_MainActivity_decodeAacBytes(JNIEnv * env, jobject this, jbyteArray input, jint numBytes) { //copy bytes from java jbyte* bufferPtr = (*env)->GetByteArrayElements(env, input, NULL); uint8_t inputBytes[numBytes + FF_INPUT_BUFFER_PADDING_SIZE]; memset(inputBytes, 0, numBytes + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(inputBytes, bufferPtr, numBytes); (*env)->ReleaseByteArrayElements(env, input, bufferPtr, 0); av_register_all(); AVCodec *codec = avcodec_find_decoder(CODEC_ID_AAC); if (codec == NULL) { LOGE("Cant find AAC codec\n"); return 0; } LOGI("AAC codec found\n"); AVCodecContext *avCtx = avcodec_alloc_context(); if (avCtx == NULL) { LOGE("Could not allocate codec context\n"); return 0; } LOGI("codec context allocated\n"); if (avcodec_open2(avCtx, codec, NULL) < 0) { LOGE("Could not open codec\n"); return 0; } LOGI("AAC codec opened"); //the input buffer AVPacket avPacket; av_init_packet(&avPacket); LOGI("AVPacket initialised\n"); avPacket.size = numBytes; //input buffer size avPacket.data = inputBytes; // the input buffer int outSize; int len; uint8_t *outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); while (avPacket.size > 0) { outSize = AVCODEC_MAX_AUDIO_FRAME_SIZE; len = avcodec_decode_audio3(avCtx, (short *) outbuf, &outSize, &avPacket); if (len < 0) { LOGE("Error while decoding\n"); return 0; } if (outSize > 0) { LOGI("Decoded some stuff\n"); } avPacket.size -= len; avPacket.data += len; } LOGI("Freeing memory\n"); av_free_packet(&avPacket); avcodec_close(avCtx); av_free(avCtx); return 0; }
The problem occurs in the call to avcodec_decode_audio3, when the decoding first occurs. I have stepped through the ffmpeg code, but can't find the problem. Any help would be greatly appreciated!
-
Installing ffmpeg on ubuntu
26 novembre 2012, par userffmpegI need to install ffmpeg on ubuntu. I have downloaded the ffmpeg-0.8.1 release. But have no clue how to install it [am new to linux too :-(]
I tried to google for some instructions, but just cannot get it done.
Can anyone be kind and a lil patient enough to help me..!
-
ffmpeg Merge 2 audio files in a previus audio file
26 novembre 2012, par George L.i have the following code to extract all audio from an avi file:
exec("/usr/local/bin/ffmpeg -i sample.avi -ab 160k -ac 2 -ar 44100 -vn allaudio.mp3");
Now it is my guide audio file and i want to add 2 more .mp3 files on it but i want the first audio file to starts in sixth second and the second audio file starts play in 20 second and all these to save it as a new audio filanl file.
Is it possible to do it with ffmpeg?
-
linphone-3.5.2 install on centOS error
26 novembre 2012, par plancysI have a problem with installation of Linhone. I follow this page When I install mediastreamer2 I got this error.
[root@IPv6B mediastreamer2]# make make all-recursive (...) videoenc.c: In function ‘ms_ffmpeg_check_init’: videoenc.c:56: warning: implicit declaration of function ‘avcodec_init’ videoenc.c: In function ‘prepare’: videoenc.c:239: warning: ‘avcodec_get_context_defaults’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3437) videoenc.c: In function ‘prepare_h263’: videoenc.c:303: error: ‘CODEC_FLAG_H263P_UMV’ undeclared (first use in this function) videoenc.c:303: error: (Each undeclared identifier is reported only once videoenc.c:303: error: for each function it appears in.) videoenc.c:305: error: ‘CODEC_FLAG_H263P_SLICE_STRUCT’ undeclared (first use in this function) videoenc.c: In function ‘enc_preprocess’: videoenc.c:345: warning: ‘avcodec_open’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3569) videoenc.c: In function ‘add_rfc2190_header’: videoenc.c:375: error: ‘FF_I_TYPE’ undeclared (first use in this function) videoenc.c: In function ‘process_frame’: videoenc.c:782: error: ‘FF_I_TYPE’ undeclared (first use in this function) videoenc.c:794: warning: ‘avcodec_encode_video’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4272) make[3]: *** [videoenc.lo] Error 1 make[3]: Leaving directory `/home/TEST/Desktop/APPS/linphone-3.5.2/mediastreamer2/src' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/TEST/Desktop/APPS/linphone-3.5.2/mediastreamer2/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/TEST/Desktop/APPS/linphone-3.5.2/mediastreamer2' make: *** [all] Error 2