
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (39)
-
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...) -
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)
Sur d’autres sites (3886)
-
Streaming audio with ffmpeg library in C++/CLR, avcodec_fill_audio_frame returning -22 error code
31 janvier 2018, par Sherl0ck_HGood morning.
So I am working on a project where I need to stream realtime video & audio in C++ over an RTMP connection using FFmpeg’s libraries. As far as I understand, the video & audio use two different streams so I am now trying to create an audio only stream.MY PROBLEM : When calling FFmpeg’s avcodec_fill_audio_frame() I receive an error code -22. This tells me nothing seeing as the FFmpeg library’s documentation...leaves a great deal to be desired.
My MainForm.h has the following (relevant) members
private: NAudio::CoreAudioApi::MMDevice^ waveDevice_chat;
private: NAudio::Wave::WaveIn^ waveInput_chat;
private: NAudio::Wave::IWavePlayer^ waveOutput_chat;
private: NAudio::Wave::BufferedWaveProvider^ waveProvider_chat;Fist step is to connect the mic :
System::Void MainForm::btnConnectMic_Click(System::Object^ sender, System::EventArgs^ e) {
msclr::interop::marshal_context context;
waveEnumerator_chat = gcnew NAudio::CoreAudioApi::MMDeviceEnumerator();
System::Collections::Generic::List^ wavePorts_chat = System::Linq::Enumerable::ToList(waveEnumerator_chat->EnumerateAudioEndPoints(DataFlow::Capture, DeviceState::Active));
if (wavePorts_chat->Count > 0) {
waveDevice_chat = (NAudio::CoreAudioApi::MMDevice^)(wavePorts_chat[0]);
waveDevice_chat->AudioEndpointVolume->Mute = false;
waveInput_chat = gcnew WaveIn();
waveInput_chat->BufferMilliseconds = 50;
waveInput_chat->DeviceNumber = 0;
waveInput_chat->WaveFormat = gcnew NAudio::Wave::WaveFormat(44100, 1);
waveInput_chat->DataAvailable += gcnew System::EventHandler(this, &MainForm::waveInput_data_available);
waveInput_chat->StartRecording();
waveProvider_chat = gcnew BufferedWaveProvider(gcnew NAudio::Wave::WaveFormat(44100, 1));
waveProvider_chat->DiscardOnBufferOverflow;
}
}Here is the code for the EventHandler which is called by NAudio when data is available
void MainForm::waveInput_data_available(System::Object^ sender, WaveInEventArgs^ e) {
if (waveProvider_chat->BufferedBytes + e->BytesRecorded > waveProvider_chat->BufferLength)
waveProvider_chat->ClearBuffer();
else
waveProvider_chat->AddSamples(e->Buffer, 0, e->BytesRecorded);
}And finally, here is the code snippet that is supposed to fill my audio frame (this is runnign in a loop in a background worker)
uint8_t* new_buffer;
int result
AVFrame* a_frame = av_frame_alloc();
AVStream* astrm;
AVCodec* acodec = avcodec_find_encoder(AVCodecID::AV_CODEC_ID_AAC);
/*
*
*
*
*/
in the loop
if (read_buffer->Length <= 0)
continue;
new_buffer = (uint8_t*)av_malloc((size_t)waveProvider_chat->BufferedBytes);
for (int i = 0; i < waveProvider_chat->BufferedBytes; i++)
new_buffer[i] = (uint8_t)read_buffer[i];
AVPacket a_pkt;
av_init_packet(&a_pkt);
a_pkt.data = nullptr;
a_pkt.size = 0;
int got_a_packet = 0;
int a_encode = avcodec_fill_audio_frame(a_frame, astrm->codec->channels, astrm->codec->sample_fmt, new_buffer, read_buffer->Length, 0);
std::cout << "[FILL] encoded response: " << a_encode << std::endl; -
FFMPEG to OpenGL Texture
23 avril 2014, par SpamdarkI was here to ask, how can I convert an AVFrame to an opengl texture. Actually, I created a renderer the outputs me the audio (Audio is working) and the video, but the video is not outputing. Here is my code :
Texture creation :
glGenTextures(1,&_texture);
glBindTexture(GL_TEXTURE_2D,_texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );Code Info : _texture variable is a GLuint that keeps the texture ID
Function that gets the AVFrame and convert it to OpenGL Texture :
int VideoGL::NextVideoFrame(){
// Get a packet from the queue
AVPacket *videopacket = this->DEQUEUE(VIDEO);
int frameFinished;
if(videopacket!=0){
avcodec_decode_video2(_codec_context_video, _std_frame,&frameFinished,videopacket);
if(frameFinished){
sws_scale(sws_ctx, _std_frame->data, _std_frame->linesize, 0, _codec_context_video->height, _rgb_frame->data, _rgb_frame->linesize);
if(_firstrendering){
glBindTexture(GL_TEXTURE_2D,_texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _codec_context_video->width,_codec_context_video->height,0,GL_RGB,GL_UNSIGNED_BYTE,_rgb_frame->data[0]);
_firstrendering = false;
}else{
glActiveTexture(_texture);
glBindTexture(GL_TEXTURE_2D,_texture);
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,_codec_context_video->width,_codec_context_video->height,GL_RGB,GL_UNSIGNED_BYTE,_rgb_frame->data[0]);
}
av_free_packet(videopacket);
return 0;
}else{
av_free_packet(videopacket);
return -1;
}
}else{
return -1;
}
return 0;
}Code Information : There is a queue where a thread store the AVFrames, this function is frequently called to get the AVFrames, until it gets a NULL it stops to being called.
That’s actually not working. (I tried to look at some questions in stack overflow, it’s still not working)
Any example, or someone that helps me to correct any error there ?Additional Data : I tried to change the GL_RGB to GL_RGBA and started to play with the formats, anyway it crashes when I try GL_RGBA (Because the width and height are very big, anyway I tried to resize them). I have tried to change the sizes to Power Of 2, stills not working.
1 Edit :
Thread function :
DWORD WINAPI VideoGL::VidThread(LPVOID myparam){
VideoGL * instance = (VideoGL*) myparam;
instance->wave_audio->Start();
int quantity=0;
AVPacket packet;
while(av_read_frame(instance->_format_context,&packet) >= 0){
if(packet.stream_index==instance->videoStream){
instance->ENQUEUE(VIDEO,&packet);
}
if(packet.stream_index==instance->audioStream){
instance->ENQUEUE(AUDIO,&packet);
}
}
instance->ENQUEUE(AUDIO,NULL);
instance->ENQUEUE(VIDEO,NULL);
return 0;
}Thread creation function :
CreateThread(NULL, 0, VidThread, this, NULL, NULL);
Where this refers to the class that contains the NextVideoFrame, and the _texture members.
Solved :
I followed some of the datenwolf tips, and now the video is displaying correctly with the audio/video :
-
How do I access the ipod-library for decoding ffmpeg ?
16 janvier 2014, par M_OnThank you to look at my question.
There is a problem with too slow to access the music file using ffmpeg.
Get the URL of the music that is in the ipod-library by using the 'valueForProperty:MPMediaItemPropertyAssetURL' method.
Use the (AVAssetExportSession Class) TSLibraryImport.m, extract the music files from ipod-library.
However, I took the extraction time is too long. (4 seconds of the 3GS iPhone, iPhone 5 is 1 second)
It was not possible to be decoded using FFmpeg If you do not the Export.
In order to use FFmpeg, it's AVPlayer can not be used.
I will never forget the grace if you can answer if you folded to know how other maybe.