
Recherche avancée
Médias (2)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (65)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)
Sur d’autres sites (12069)
-
vc1dsp : Change remaining stride parameters to ptrdiff_t
29 mars 2022, par Martin Storsjövc1dsp : Change remaining stride parameters to ptrdiff_t
The existing x86 assembly for loop filters uses the stride as a
full register without clearing/sign extending the upper half
of the registers on x86_64.This avoids crashes if the caller would have passed nonzero bits
in the previously undefined upper 32 bits of the parameters.Signed-off-by : Martin Storsjö <martin@martin.st>
-
C++ ffmpeg mp4 to mp3 transcoding
2 juillet 2014, par UnknownI am working on an application that converts the audio of mp4 video to mp3 files. I managed to compile ffmpeg with libmp3lame.
This is what I have so far
// Step 1 - Register all formats and codecs
avcodec_register_all();
av_register_all();
AVFormatContext* fmtCtx = avformat_alloc_context();
// Step 2 - Open input file, and allocate format context
if(avformat_open_input(&fmtCtx, filePath.toLocal8Bit().data(), NULL, NULL) < 0)
qDebug() << "Error while opening " << filePath;
// Step 3 - Retrieve stream information
if(avformat_find_stream_info(fmtCtx, NULL) < 0)
qDebug() << "Error while finding stream info";
// Step 4 - Find the audiostream
int audioStreamIdx = -1;
for(uint i=0; inb_streams; i++) {
if(fmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
audioStreamIdx = i;
break;
}
}
if(audioStreamIdx != -1) {
AVCodecContext *audioDecCtx = fmtCtx->streams[audioStreamIdx]->codec;
// Step 5
AVCodec *aCodec = avcodec_find_decoder(audioDecCtx->codec_id);
avcodec_open2(audioDecCtx, aCodec, NULL);
// Step 6
AVOutputFormat* outputFormat = av_guess_format(NULL, outPath.toLocal8Bit().data(), NULL);
// Step 7
AVFormatContext *outformatCtx = avformat_alloc_context();
// Step 8
AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_MP3);
//encoder->sample_fmts = AV_SAMPLE_FMT_S16;
AVCodecContext *audioEncCtx = avcodec_alloc_context3(encoder);
audioEncCtx->sample_fmt = AV_SAMPLE_FMT_S16P;
audioEncCtx->sample_rate = 44100;
audioEncCtx->channel_layout = av_get_default_channel_layout(audioDecCtx->channels);
avcodec_open2(audioEncCtx, encoder, NULL);
// Step 9
AVFrame *frame = av_frame_alloc();
AVPacket pkt;
av_init_packet(&pkt);
// Step 10
while(av_read_frame(fmtCtx, &pkt) == 0) {
int got_frame = 0;
if(pkt.stream_index == audioStreamIdx) {
int len = avcodec_decode_audio4(audioDecCtx, frame, &got_frame, &pkt);
if(got_frame) {
// Step 11
AVPacket outPkt;
av_init_packet(&outPkt);
int got_packet = 0;
qDebug() << "This is printed";
int error = avcodec_encode_audio2(audioEncCtx, &outPkt, frame, &got_packet);
qDebug() << "This is not printed...";
}
}
}
av_free_packet(&pkt);
}
avformat_close_input(&fmtCtx);It goes wrong at the line avcodec_encode_audio2(). It seems like the function does not return. As you can see, the line after the encoding line is not printed. What am I doing wrong ?
Thanks in advance !
-
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 !