Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (69)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (9916)
-
libFLAC/md5.c : Minor formatting fixes
6 juillet 2015, par Erik de Castro Lopo -
Suppress MSVS warnings when compiling for x86-64.
10 avril 2014, par Erik de Castro Lopo -
ffmpeg AVStream::codecpar is null
12 décembre 2022, par RuiChen0101I'm trying to make a simple audio decoder by using libav, and I encounter a problem.
I cannot get AVCodecParameters from AVStream, codepar always is null.


here is my code.


#include 
#include 
#include 
#include 

extern "C" {
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>channel_layout.h>
#include <libswresample></libswresample>swresample.h>
}

int main(int argc, char** argv) {
 if (argc != 2) {
 fprintf(stderr, "usage: %s input_file > output_file\n", argv[0]);
 exit(1);
 }

 const int out_channels = 2, out_samples = 512, sample_rate = 44100;

 int max_buffer_size;

 // register supported formats and codecs
 av_register_all();

 // allocate empty format context
 // provides methods for reading input packets
 AVFormatContext* fmt_ctx = avformat_alloc_context();

 // determine input file type and initialize format context
 if (avformat_open_input(&fmt_ctx, argv[1], NULL, NULL) != 0) {
 fprintf(stderr, "error: avformat_open_input()\n");
 exit(1);
 }

 // determine supported codecs for input file streams and add
 // them to format context
 if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
 fprintf(stderr, "error: avformat_find_stream_info()\n");
 exit(1);
 }

 AVCodec* codec = NULL;
 int stream = 0;

 // find audio stream in format context
 
 fprintf(stderr, "%d\n", fmt_ctx->nb_streams);
 for (int i = 0; i < fmt_ctx->nb_streams; i++) {
 AVCodecParameters* avCodecParameters = NULL;
 avCodecParameters = fmt_ctx->streams[i]->codecpar;
 if(!avCodecParameters){
 fprintf(stderr, "error: CodecParameters\n");// always fail here
 exit(1);
 }
 if(avCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO){
 stream = i;
 codec = avcodec_find_decoder(avCodecParameters->codec_id);
 if (!codec) {
 fprintf(stderr, "error: avcodec_find_decoder()\n");
 exit(1);
 }
 break;
 }
 }

 if (stream == fmt_ctx->nb_streams) {
 fprintf(stderr, "error: no audio stream found\n");
 exit(1);
 }
 return 0;
}


For the input file format, I have tried .wav and .m4a file


and the output always is


1
error: CodecParameters


Dose anyone has the same problem ?


How to solve it ?


thanks !