
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 (49)
-
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 (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
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 ;
Sur d’autres sites (5405)
-
How parse and decode H264 file with libav/ffmpeg ?
12 août 2022, par isrepeatAccording to official documentations I try decode my
test.mp4
withAV_CODEC_ID_H264
.

Of course I can do this with
av_read_frame()
, but how do it withav_parser_parse2()
?

The problem occurs at
avcodec_send_packet(...)
atdecode_nal_units(...)
atff_h2645_packet_split(...)
[h264dec.c]

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

//#define INBUF_SIZE 4096
#define INBUF_SIZE 256000

void decode(AVCodecContext* dec_ctx, AVFrame* frame, AVPacket* pkt, const char* filename);

int main(int argc, char** argv)
{
 const char* filename;
 const AVCodec* codec;
 AVFormatContext* formatCtx = NULL;
 AVCodecParserContext* parser;
 AVCodecContext* c = NULL;
 AVStream* videoStream = NULL;
 FILE* f;
 AVFrame* frame;
 uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
 uint8_t* data;
 size_t data_size;
 int ret;
 AVPacket* pkt;

 filename = "D:\\test.mp4";

 //if (avformat_open_input(&formatCtx, filename, nullptr, nullptr) < 0) {
 // throw std::exception("Could not open source file");
 //}

 //if (avformat_find_stream_info(formatCtx, nullptr) < 0) {
 // throw std::exception("Could not find stream information");
 //}

 //videoStream = formatCtx->streams[0];



 pkt = av_packet_alloc();
 if (!pkt)
 exit(1);

 /* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */
 memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);

 /* find the MPEG-1 video decoder */
 //codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
 codec = avcodec_find_decoder(AV_CODEC_ID_H264);
 if (!codec) {
 fprintf(stderr, "Codec not found\n");
 exit(1);
 }

 parser = av_parser_init(codec->id);
 if (!parser) {
 fprintf(stderr, "parser not found\n");
 exit(1);
 }

 parser->flags = PARSER_FLAG_COMPLETE_FRAMES;

 c = avcodec_alloc_context3(codec);
 if (!c) {
 fprintf(stderr, "Could not allocate video codec context\n");
 exit(1);
 }

 /* For some codecs, such as msmpeg4 and mpeg4, width and height
 MUST be initialized there because this information is not
 available in the bitstream. */

 //avcodec_parameters_to_context(c, videoStream->codecpar);

 /* open it */
 if (avcodec_open2(c, codec, NULL) < 0) {
 fprintf(stderr, "Could not open codec\n");
 exit(1);
 }

 f = fopen(filename, "rb");
 if (!f) {
 fprintf(stderr, "Could not open %s\n", filename);
 exit(1);
 }

 frame = av_frame_alloc();
 if (!frame) {
 fprintf(stderr, "Could not allocate video frame\n");
 exit(1);
 }

 // ---- Use parser to get packets ----
 while (!feof(f)) {
 /* read raw data from the input file */
 data_size = fread(inbuf, 1, INBUF_SIZE, f);
 if (!data_size)
 break;

 /* use the parser to split the data into frames */
 data = inbuf;
 while (data_size > 0) {
 ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
 if (ret < 0) {
 fprintf(stderr, "Error while parsing\n");
 exit(1);
 }
 data += ret;
 data_size -= ret;

 if (pkt->size)
 decode(c, frame, pkt, outfilename);
 }
 }

 // ---- Use FormatContext to get packets ----
 // while (av_read_frame(fmt_ctx, pkt) == 0)
 // {
 // if (pkt->stream_index == AVMEDIA_TYPE_VIDEO) {
 // if (pkt->size > 0)
 // decode(cdc_ctx, frame, pkt, fp_out);
 // }
 // }

 /* flush the decoder */
 decode(c, frame, NULL, outfilename);

 fclose(f);

 av_parser_close(parser);
 avcodec_free_context(&c);
 av_frame_free(&frame);
 av_packet_free(&pkt);

 return 0;
}

void decode(AVCodecContext* dec_ctx, AVFrame* frame, AVPacket* pkt, const char* filename)
{
 char buf[1024];
 int ret;

 ret = avcodec_send_packet(dec_ctx, pkt);
 if (ret < 0) {
 char buff[255]{ 0 };
 std::string strError = av_make_error_string(buff, 255, ret);
 fprintf(stderr, "Error sending a packet for decoding\n");
 exit(1);
 }

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

 printf("saving frame %3d\n", dec_ctx->frame_number);
 fflush(stdout);
 /* the picture is allocated by the decoder. no need to
 free it */
 // handle frame ...
 }
}



-
How to stream WEBM Video by Media Source Extensions API
4 octobre 2023, par Mahmoud KhudairiI'm developing video streaming website using MSE.


Each video converted to FragmentedMP4 (h264,aac =>
avc1,mp4a
)

It is working very fine but what if I wanted to use
webm
format ? like YouTube or Facebook they sometimes use it.

I want to know how to get index (like sidx atom in fmp4) from
VP8
,VP9
orvorbis
codec
I use bento4 and ffmpeg to get metadata from video and audio
but bento4 is for MP4 Just, and use MP4BoxJS to parse index in browser by JavaScript.

What should I use ?
ffmpeg
or what to create fragmentedwebm
or something like that and get index stream info to append segments to MSESourceBuffer
and sure it should be seekable stream..

-
ffmpeg to auto lower/fade audio volume of one audio stream when microphone voice detected ?
12 juin 2021, par Lectos LaciousI want to do live audio translation via microphone, to get streamed live vid/audio from Facebook, plug the mic into laptop and do live translation by mixing existing audio stream with one coming from the mic (translation). This is OK, somehow I got this part by using audio filter "amix" and mix two audio streams together into one. Now I want to add more perfection to it, is it possible to (probably is) upon mic voice detection to automatically decrease/fade down 20% volume of input/original audio stream to hear translation (mic audio) more loudly and then when mic action/voice stops for lets say 3-5 seconds the volume of original audio stream fades up/goes up to normal volume... is this too much, i can play with sox or similar ?