
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (66)
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (5915)
-
Play video using HTML5 video tag
21 janvier 2014, par user3217695Hi i need to display video in all the browsers using html5.
I am uploading the file and creating html structure and it plays only mp4 format video, but not other uploaded formats, and i use command line to convert files but the converted files doesn't play in video tag.
For conversion I use
ffmpeg
video conversion from one towebm
format. Conversion works, but viedos don't play.Please find me
ffmpeg
code, which converts all videos towebm
, so i can play the converted video using html5. -
rtmp : Support play method in listen mode
15 septembre 2013, par Luca Barbato -
How to play audio using libao and FFmpeg in C ?
12 mars 2024, par OmegaLol21I am trying to create a simple prototype application that opens a video file and plays its audio. I am using the FFmpeg libraries (libavcodec, libavformat, etc) to open and decode the video, and I am attempting to use libao to play the audio. I tried looking up code examples but a lot of them either don't work or use deprecated functions.


So far, I managed to come up with this :


#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libswresample></libswresample>swresample.h>
#include <ao></ao>ao.h>

int main(int argc, char** argv) {
 AVFormatContext* format_ctx = avformat_alloc_context();
 int audio_stream_index = -1;
 AVCodecContext* codec_ctx = NULL;
 AVCodec* codec = NULL;
 AVPacket packet;
 AVFrame* frame = NULL;
 ao_device* device = NULL;
 ao_sample_format sample_format;
 uint8_t* output_buffer = NULL;
 int output_linesize;

 avformat_open_input(&format_ctx, "test.mp4", NULL, NULL);
 avformat_find_stream_info(format_ctx, NULL);

 for (int i = 0; i < format_ctx->nb_streams; i++) {
 if (format_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 audio_stream_index = i;
 break;
 }
 }

 codec_ctx = avcodec_alloc_context3(NULL);
 avcodec_parameters_to_context(codec_ctx, format_ctx->streams[audio_stream_index]->codecpar);
 codec = avcodec_find_decoder(codec_ctx->codec_id);
 avcodec_open2(codec_ctx, codec, NULL);

 // Initialize libao
 ao_initialize();
 int driver_id = ao_default_driver_id();

 sample_format.bits = 16;
 sample_format.channels = 2;
 sample_format.rate = 44100;
 sample_format.byte_format = AO_FMT_NATIVE;
 sample_format.matrix = 0;
 device = ao_open_live(driver_id, &sample_format, NULL);
 if (!device) {
 fprintf(stderr, "Could not open audio device\n");
 return 1;
 }

 frame = av_frame_alloc();

 while (av_read_frame(format_ctx, &packet) >= 0) {
 if (packet.stream_index == audio_stream_index) {
 int ret = avcodec_send_packet(codec_ctx, &packet);
 if (ret < 0) {
 fprintf(stderr, "Error sending packet for decoding\n");
 break;
 }

 while (ret >= 0) {
 ret = avcodec_receive_frame(codec_ctx, frame);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
 }
 else if (ret < 0) {
 fprintf(stderr, "Error during decoding\n");
 break;
 }

 ao_play(device, (char*)frame->data[0], frame->nb_samples * 2 * frame->channels);
 }
 }
 av_packet_unref(&packet);
 }

 // Clean up
 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_close_input(&format_ctx);
 ao_close(device);
 ao_shutdown();
 av_freep(&output_buffer);

 return 0;
}



This is the closest I have gotten to play audio. It plays audio but there is a lot of static sound in the background. I did try using using
frame->linesize[0]
fornum_bytes
inao_play
but that didn't produce a sound that sounded at all like the video.

Is there something I am doing wrong or missing ?


EDIT : While doing more testing, I managed to find out that the above code sample outputs pure static in the left speaker, however, in the right speaker, it does play the audio, albeit heavily distorted ?