
Recherche avancée
Autres articles (50)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (7002)
-
Issue when trying to resample audio using swr_convert_frame
18 décembre 2022, par ClaaaudioI'm receiving MPEG packets from a IP camera, that have both video and audio muxed (H264/AAC). I'm able to successfully demux and decode the packets but when I try to resample the audio frames I keep getting -22 (AVERROR_INVAL) when I call swr_convert_frame.


Here's the code function that decodes the packet and tries to resample the output frame.


function TDecoder.DecodeAudioPacket(pCodecID: AVCodecID): Integer;
var
 vResponse, vDataSize: Integer;
begin
 if (not fAudioDecoderSet) then
 SetupAudioDecoder(pCodecID)
 else if (fAudioCodec.id <> pCodecID) then
 begin
 TeardownAudioDecoder;
 SetupAudioDecoder(pCodecID);
 end;

 vResponse := avcodec_send_packet(fAudioCodecCtx, fPacket);

 if vResponse < 0 then
 Exit(vResponse);

 while (vResponse >= 0) do
 begin
 //SetLastCompletePacket(fPacket.data, fPacket.size);
 vResponse := avcodec_receive_frame(fAudioCodecCtx, fAudioFrame);
 if (vResponse = AVERROR_EAGAIN) or (vResponse = AVERROR_EOF) then
 Break
 else if vResponse < 0 then
 Exit(vResponse);

 if vResponse >= 0 then
 begin
 fAudioFrame.channel_layout := fAudioCodecCtx.channel_layout;
 fAudioFrame.channels := av_get_channel_layout_nb_channels(fAudioFrame.channel_layout);
 fAudioFrame.format := Integer(fAudioCodecCtx.sample_fmt);
 fAudioFrame.sample_rate := fAudioCodecCtx.sample_rate;

 av_frame_copy_props(fResampledFrame, fAudioFrame);

 fResampledFrame.channel_layout := fAudioCodecCtx.channel_layout;
 fResampledFrame.channels := av_get_channel_layout_nb_channels(fResampledFrame.channel_layout);
 fResampledFrame.format := 1;
 fResampledFrame.sample_rate := fAudioCodecCtx.sample_rate;
 //fResampledFrame.nb_samples := fAudioCodecCtx.frame_size;

 if fResampler = nil then
 SetupResampler;
 // swr_alloc;
 // swr_config_frame(fResampler, fResampledFrame, fAudioFrame);
 // swr_init;

 var e := swr_convert_frame(fResampler, fResampledFrame, fAudioFrame);
 if e < 0 then
 begin
 var str: PAnsiChar := GetMemory(4096);
 av_strerror(e, str, 4096);
 if e = AVERROR_OUTPUT_CHANGED then
 DebugMsg(string(AnsiString(str)));
 FreeMemory(str);
 if e < 0 then
 Exit(-1);
 end;

 vDataSize := av_samples_get_buffer_size(nil, fAudioCodecCtx.channel_layout,
 fResampledFrame.nb_samples, AVSampleFormat(fResampledFrame.format), 1);

 if vDataSize <= 0 then
 Exit(-1);

 if Assigned(fOnAudioFrameDecoded) then
 fOnAudioFrameDecoded(fResampledFrame.channel_layout, fResampledFrame.sample_rate, 16,
 fResampledFrame.data[0], vDataSize);
 end;
 end;
 Exit(0);
end;



I've validated that the data coming from the IP camera is valid, if I save the packets to a file I'm able to play it with VLC .


I've also validated that the SwrContext is configured and initialized correctly.


I used the very same code to decode frames from audio files and so far I haven't had a problem.


-
Error in ffmpeg when reading from UDP stream
24 juillet 2013, par six6and1oneI'm trying to process frames from a UDP stream using ffmpeg. Everything will run fine for a while but
av_read_frame()
will always eventually return eitherAVERROR_EXIT
(Immeditate exit requested) or-5
(Error number -5 occurred) while the stream should still be running fine. Right before the error it always prints the following message to the console[mpeg2video @ 0caf6600] ac-tex damaged at 14 10
[mpeg2video @ 0caf6600] Warning MVs not available
[mpeg2video @ 0caf6600] concealing 800 DC, 800 AC, 800 MV errors in I frame(the numbers in the message vary from run to run)
I have a suspicion that the error is related to calling
av_read_frame
too quickly. If I have it run as fast as possible, I usually get an error within 10-20 frames, but if I put a sleep before reading it will run fine for a minute or so and then exit with an error. I realize this is hacky and assume there is a better solution. Bottom line : is there a way to dynamically check if 'av_read_frame()' is ready to be called ? or a way to supress the error ?Psuedo code of what I'm doing below. Thanks in advance for the help !
void getFrame()
{
//wait here?? seems hacky...
//boost::this_thread::sleep(boost::posix_time::milliseconds(25));
int av_read_frame_error = av_read_frame(m_input_format_context, &m_input_packet);
if(av_read_frame_error == 0){
//DO STUFF - this all works fine when it gets here
}
else{
//error
char errorBuf[AV_ERROR_MAX_STRING_SIZE];
av_make_error_string(errorBuf, AV_ERROR_MAX_STRING_SIZE, av_read_frame_error);
cout << "FFMPEG Input Stream Exit Code: " << av_read_frame_error << " Message: " << errorBuf << endl;
}
} -
pexpect.run() terminates before ending ffmpeg without finishing the conversion
24 novembre 2012, par DaviseinI'm working on a python script that does a custom conversion of videos via ffmpeg.
My problem is that the execution of ffmpeg stops suddenly after a bit of conversion (usually 3-4 mb out of 100mb) with a None exit code.
I'm using the pexpect library. Currently I do not check the progress but I will in a close future. It seems that I am right using pexpect regarding these questions FFMPEG and Pythons subprocess and Getting realtime output from ffmpeg to be used in progress bar (PyQt4, stdout). This is the command that I'm running (I have checked that it's exactly this one)
nice ffmpeg -i '/full/path' -s 640x360 -strict experimental -vcodec libx264
-f mp4 - coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -crf 26
-bufsize 4000k -maxrate 350k -preset medium -acodec libvo_aacenc
-ar 48000.0 -ab 128K -threads 2 -y '/full/path/out'I am using nice but I have tried also without it and the result ends up being the same.
I'm running pexpect this way :
output, exit = pexpect.run(self.command(), withexitstatus=True,\
logfile=logfile)
print output
print exitOf course I have tried the same command on the command line and it works fine.
Any clue on what might be happening ?