
Recherche avancée
Autres articles (96)
-
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 (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
Installation en mode standalone
4 février 2011, parL’installation de la distribution MediaSPIP se fait en plusieurs étapes : la récupération des fichiers nécessaires. À ce moment là deux méthodes sont possibles : en installant l’archive ZIP contenant l’ensemble de la distribution ; via SVN en récupérant les sources de chaque modules séparément ; la préconfiguration ; l’installation définitive ;
[mediaspip_zip]Installation de l’archive ZIP de MediaSPIP
Ce mode d’installation est la méthode la plus simple afin d’installer l’ensemble de la distribution (...)
Sur d’autres sites (4635)
-
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 ...
 }
}



-
ffmpeg hls video recording timing information is inaccurate
28 juin 2018, par HarisI am recording the rtsp stream in HLS format which is working fine with below command.
~/bin/ffmpeg -i rtsp://10.0.7.39:554/media/live/1/1 -c:a aac -c:v copy -hls_list_size 65535 -hls_time 2 live.m3u8
But when I check the duration of each
ts
file withlive.m3u8
file content the value is not accurate.Here is the live.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:2.000000,
live0.ts
#EXTINF:2.000000,
live1.ts
#EXTINF:1.200000,
live2.ts
#EXTINF:2.500000,
live3.ts
#EXTINF:2.000000,
live4.ts
#EXTINF:2.600000,
live5.ts
#EXTINF:1.700000,
live6.ts
#EXT-X-ENDLISTAnd when I check the timing information of the ts file
live2.ts
using the command,~/bin/ffprobe -i live2.ts -show_entries format=duration -v quiet -of csv="p=0"
I am getting the value
2.136000
where as in m3u8 file it is1.20000
.I have build the latest FFMPEG based on official guild https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu.
OS : Ubuntu 12.04
ffmpeg Version
$~/bin//ffmpeg -version
ffmpeg version N-91369-g4ac88ba Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.1-2ubuntu1~12.04)
configuration: --prefix=/home/haris/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/haris/ffmpeg_build/include --extra-ldflags=-L/home/haris/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/haris/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 20.104 / 58. 20.104
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 25.100 / 7. 25.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100Note
If I tested the same command in Ubuntu 16.04 where ffmpeg installed with
apt-get
every thing works fine.Here is the ffmpeg details
$ ~/bin/ffmpeg -version
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100What could be the cause, any help will be appreciated.
-
ffmpeg hls video recording timing inforamtion is inaccurate
27 juin 2018, par HarisI am recording the rtsp stream in HLS format which is working fine with below command.
~/bin/ffmpeg -i rtsp://10.0.7.39:554/media/live/1/1 -c:a aac -c:v copy -hls_list_size 65535 -hls_time 2 live.m3u8
But when I check the the duration of each
ts
file withlive.m3u8
file content the value is not accurate.Here is the live.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:2.000000,
live0.ts
#EXTINF:2.000000,
live1.ts
#EXTINF:1.200000,
live2.ts
#EXTINF:2.500000,
live3.ts
#EXTINF:2.000000,
live4.ts
#EXTINF:2.600000,
live5.ts
#EXTINF:1.700000,
live6.ts
#EXT-X-ENDLISTAnd when I check the timing information of the ts file
live2.ts
using the command,~/bin/ffprobe -i live2.ts -show_entries format=duration -v quiet -of csv="p=0"
I am getting the value
2.136000
where as in m3u8 file it is1.20000
.I have build the latest FFMPEG based on official guild https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu.
OS : Ubuntu 12.04
ffmpeg Version
$~/bin//ffmpeg -version
ffmpeg version N-91369-g4ac88ba Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.1-2ubuntu1~12.04)
configuration: --prefix=/home/haris/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/haris/ffmpeg_build/include --extra-ldflags=-L/home/haris/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/haris/bin --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 20.104 / 58. 20.104
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 25.100 / 7. 25.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100Note
If I tested the same command in Ubuntu 16.04 where ffmpeg installed with
apt-get
every thing works fine.Here is the ffmpeg details
$ ~/bin/ffmpeg -version
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100What could be the cause, any help will be appreciated.