
Recherche avancée
Autres articles (75)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (13356)
-
Video Conferencing in HTML5 : WebRTC via Socket.io
1er janvier 2014, par silviaSix months ago I experimented with Web sockets for WebRTC and the early implementations of PeerConnection in Chrome. Last week I gave a presentation about WebRTC at Linux.conf.au, so it was time to update that codebase.
I decided to use socket.io for the signalling following the idea of Luc, which made the server code even smaller and reduced it to a mere reflector :
var app = require(’http’).createServer().listen(1337) ; var io = require(’socket.io’).listen(app) ;
io.sockets.on(’connection’, function(socket)
socket.on(’message’, function(message)
socket.broadcast.emit(’message’, message) ;
) ;
) ;Then I turned to the client code. I was surprised to see the massive changes that PeerConnection has gone through. Check out my slide deck to see the different components that are now necessary to create a PeerConnection.
I was particularly surprised to see the SDP object now fully exposed to JavaScript and thus the ability to manipulate it directly rather than through some API. This allows Web developers to manipulate the type of session that they are asking the browsers to set up. I can imaging e.g. if they have support for a video codec in JavaScript that the browser does not provide built-in, they can add that codec to the set of choices to be offered to the peer. While it is flexible, I am concerned if this might create more problems than it solves. I guess we’ll have to wait and see.
I was also surprised by the need to use ICE, even though in my experiment I got away with an empty list of ICE servers – the ICE messages just got exchanged through the socket.io server. I am not sure whether this is a bug, but I was very happy about it because it meant I could run the whole demo on a completely separate network from the Internet.
The most exciting news since my talk is that Mozilla and Google have managed to get a PeerConnection working between Firefox and Chrome – this is the first cross-browser video conference call without a plugin ! The code differences are minor.
Since the specification of the WebRTC API and of the MediaStream API are now official Working Drafts at the W3C, I expect other browsers will follow. I am also looking forward to the possibilities of :
- multi-peer video conferencing like the efforts around webrtc.io,
- the media stream recording API,
- and the peer-to-peer data API.
The best places to learn about the latest possibilities of WebRTC are webrtc.org and the W3C WebRTC WG. code.google.com has open source code that continues to be updated to the latest released and interoperable features in browsers.
The video of my talk is in the process of being published. There is a MP4 version on the Linux Australia mirror server, but I expect it will be published properly soon. I will update the blog post when that happens.
-
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.