Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
play audio (stream) with ffmpeg on iphone
22 août 2011, par The Psicopathi compiled FFMpeg and i have put them in the xcode project, i don't found in the net any tutorial for stream a wma file with this lib, someone have any tutorial links? (or can make me any example?) thanks!
-
FFMPEG with QT memory leak
22 août 2011, par Timothy BaldridgeLet me start with a code clip:
QByteArray ba; ba.resize(500000); int encsize = avcodec_encode_video(context, (uint8_t*)ba.data(), 500000, frame.unownedPointer());
What I'm doing is encoding the data from frame and putting the data into the buffer pointed at QByteArray. If I comment out the avcodec_encode_video line my memory leak goes away. unownedPointer() looks like this:
if (this->frame != NULL) return this->frame; this->frame = avcodec_alloc_frame(); uchar *data = this->img.bits(); frame->data[0] = (uint8_t *)data; frame->data[1] = (uint8_t *)data + 1; frame->data[2] = (uint8_t *)data + 2; frame->linesize[0] = width * lineSize(this->fmt); frame->linesize[1] = width * lineSize(this->fmt); frame->linesize[2] = width * lineSize(this->fmt); return this->frame;
Where this->frame is a AVFrame *, and this->img is a QImage.
At a encoding rate of about 30fps, I'm getting a memory leak of about 50MB/sec. So I'm not sure what the issue could be. It seems as if avcodec_encode_video() is copying memory and never freeing it or something. Any ideas?
If avcodec_encode_video is converting my RGB24 data to YUV420P would it be modifying the data pointed to by frame.unownedPointer()?
-
possible C code implementation ideas for a given shell script(related to ffmpeg)
21 août 2011, par TedThe shell script i'm trying to implement goes like this,
#!/bin/bash while [ 1 ] do nc -l 1234 | ffmpeg -i pipe:0 -vcodec mpeg4 -s qcif -f m4v -y pipe:1 | nc localhost 1235 done
what it does is to simply take in a stream of video input through network and do live video transcoding(with ffmpeg of course!) and streaming back the video through the net. my question is how should i go by to implement this functionality in a clean C code. i know i can use popen() to pipe such a command from a c code but i would like to do better. may be with sockets and staff... any pointers are appreciated.
AskLearnDo.
-
Iphone Streaming and playing Audio Problem
20 août 2011, par KayKayI am trying to make an app that plays audio stream using ffmpeg, libmms.
I can open mms server, get stream, and decode audio frame to raw frame using suitable codec.
However I don't know how to do next.
I think I must useAudioToolbox/AudioToolbox.h
and make audioqueue.
but however when I give audioqueuebuffer decode buffer's memory and play, Only plays the white noise.
Here is my code.What am i missing?
Any comment and hint is very appreciated.
Thanks very much.while(av_read_frame(pFormatCtx, &pkt)>=0) { int pkt_decoded_len = 0; int frame_decoded_len; int decode_buff_remain=AVCODEC_MAX_AUDIO_FRAME_SIZE * 5; if(pkt.stream_index==audiostream) { frame_decoded_len=decode_buff_remain; int16_t *decode_buff_ptr = decode_buffer; int decoded_tot_len=0; pkt_decoded_len = avcodec_decode_audio2(pCodecCtx, decode_buff_ptr, &frame_decoded_len, pkt.data, pkt.size); if (pkt_decoded_len <0) break; AudioQueueAllocateBuffer(audioQueue, kBufferSize, &buffers[i]); AQOutputCallback(self, audioQueue, buffers[i], pkt_decoded_len); if(i == 1){ AudioQueueSetParameter(audioQueue, kAudioQueueParam_Volume, 1.0); AudioQueueStart(audioQueue, NULL); } i++; } } void AQOutputCallback(void *inData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, int copySize) { mmsDemoViewController *staticApp = (mmsDemoViewController *)inData; [staticApp handleBufferCompleteForQueue:inAQ buffer:inBuffer size:copySize]; } - (void)handleBufferCompleteForQueue:(AudioQueueRef)inAQ buffer:(AudioQueueBufferRef)inBuffer size:(int)copySize { inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; memcpy((char*)inBuffer->mAudioData, (const char*)decode_buffer, copySize); AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL); }
-
Where is the documentation for the Mjpeg codec used in mencoder, VLC and FFMpeg ?
18 août 2011, par SugrueMencoder has a lovely option for converting a mjpeg file into an avi file with an 'MJPG' codec that plays in VLC.
The command line to do this is:
mencoder filename.mjpeg -oac copy -ovc copy -o outputfile.avi -speed 0.3
where 0.3 is the ratio of the desired play framerate to the default 25 fps. All this does is make a copy of the mjpeg file, put an avi header on top and at the end, what seems to be an index of the frame positions in the file.
I want to replicate this in my own code, but I can't find documentation anywhere. What is the exact format of the index section? The header has extra filler bytes in it for some reason - whats this about?
Anyone know where I can find documentation? Both mencoder and vlc seem to have this codec built in.