
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (47)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (10009)
-
libav seeking to n seconds in a video and saving frames there onwards
7 juillet 2022, par Sam KoreI've been trying to seek in a mpegts video file. After exploring many codes, I've come up to the following stage of fetching frames and saving them.
However after using av_seek_frame also I'm getting following results :


- 

- Initial 7-8 frames are saved as grey frames.
- Thereafter frames are fetched from beginning of the video only. i.e. 0 seconds onwards, while I'm trying to seek from say 12th seconds onwards.






Can you please explain how should I be calculating the timestamp and do the things correctly ?



int main(int argc, const char *argv[])
{

 int stream_id;
 int64_t timestamp;
 char ts_buf[60];


 if (argc < 2) {
 printf("You need to specify a media file.\n");
 return -1;
 }
 
 logging("initializing all the containers, codecs and protocols.");

 
 AVFormatContext *pFormatContext = avformat_alloc_context();
 if (!pFormatContext) {
 logging("ERROR could not allocate memory for Format Context");
 return -1;
 }

 logging("opening the input file (%s) and loading format (container) header", argv[1]);
 
 if (avformat_open_input(&pFormatContext, argv[1], NULL, NULL) != 0) {
 logging("ERROR could not open the file");
 return -1;
 }

 logging("format %s, duration %lld us, bit_rate %lld", pFormatContext->iformat->name, pFormatContext->duration, pFormatContext->bit_rate);

 logging("finding stream info from format");
 
 if (avformat_find_stream_info(pFormatContext, NULL) < 0) {
 logging("ERROR could not get the stream info");
 return -1;
 }

 AVCodec *pCodec = NULL;
 AVCodecParameters *pCodecParameters = NULL;
 int video_stream_index = -1;

 // loop though all the streams and print its main information
 for (int i = 0; i < pFormatContext->nb_streams; i++)
 {
 AVCodecParameters *pLocalCodecParameters = NULL;
 pLocalCodecParameters = pFormatContext->streams[i]->codecpar;
 logging("AVStream->time_base before open coded %d/%d", pFormatContext->streams[i]->time_base.num, pFormatContext->streams[i]->time_base.den);
 logging("AVStream->r_frame_rate before open coded %d/%d", pFormatContext->streams[i]->r_frame_rate.num, pFormatContext->streams[i]->r_frame_rate.den);
 logging("AVStream->start_time %" PRId64, pFormatContext->streams[i]->start_time);
 logging("AVStream->duration %" PRId64, pFormatContext->streams[i]->duration);

 logging("finding the proper decoder (CODEC)");

 AVCodec *pLocalCodec = NULL;

 pLocalCodec = avcodec_find_decoder(pLocalCodecParameters->codec_id);

 if (pLocalCodec==NULL) {
 logging("ERROR unsupported codec!");
 // In this example if the codec is not found we just skip it
 continue;
 }

 // when the stream is a video we store its index, codec parameters and codec
 if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_VIDEO) {
 if (video_stream_index == -1) {
 video_stream_index = i;
 pCodec = pLocalCodec;
 pCodecParameters = pLocalCodecParameters;
 }

 logging("Video Codec: resolution %d x %d", pLocalCodecParameters->width, pLocalCodecParameters->height);
 } else if (pLocalCodecParameters->codec_type == AVMEDIA_TYPE_AUDIO) {
 logging("Audio Codec: %d channels, sample rate %d", pLocalCodecParameters->channels, pLocalCodecParameters->sample_rate);
 }

 // print its name, id and bitrate
 logging("\tCodec %s ID %d bit_rate %lld", pLocalCodec->name, pLocalCodec->id, pLocalCodecParameters->bit_rate);
 }

 if (video_stream_index == -1) {
 logging("File %s does not contain a video stream!", argv[1]);
 return -1;
 }

 AVCodecContext *pCodecContext = avcodec_alloc_context3(pCodec);
 if (!pCodecContext)
 {
 logging("failed to allocated memory for AVCodecContext");
 return -1;
 }

 if (avcodec_parameters_to_context(pCodecContext, pCodecParameters) < 0)
 {
 logging("failed to copy codec params to codec context");
 return -1;
 }

 if (avcodec_open2(pCodecContext, pCodec, NULL) < 0)
 {
 logging("failed to open codec through avcodec_open2");
 return -1;
 }

 AVFrame *pFrame = av_frame_alloc();
 if (!pFrame)
 {
 logging("failed to allocate memory for AVFrame");
 return -1;
 }

 AVPacket *pPacket = av_packet_alloc();
 if (!pPacket)
 {
 logging("failed to allocate memory for AVPacket");
 return -1;
 }

 /*seek for 20 seconds*/
 int64_t incr, pos = 5;

 int64_t seek_target = (pos * AV_TIME_BASE), stream_index = 0, how_many_packets_to_process = 50, response = 0;

 printf("seek_target before : %lu\n", seek_target);
 seek_target = av_rescale_q(seek_target, AV_TIME_BASE_Q, pFormatContext->streams[stream_index]->time_base);

 printf("seek_target after: %lu\n", seek_target);

 do
 {
 response = decode_packet(pFormatContext, pPacket, pCodecContext, pFrame, seek_target);
 if (response < 0)
 break;
 avcodec_flush_buffers(pCodecContext);

 /*av_frame_unref(pFrame);
 av_packet_unref(pPacket);*/
 // stop it, otherwise we'll be saving hundreds of frames
 if (--how_many_packets_to_process <= 0) 
 break;

 }while(1);

logging("releasing all the resources");

 avformat_close_input(&pFormatContext);
 av_packet_free(&pPacket);
 av_frame_free(&pFrame);
 avcodec_free_context(&pCodecContext);
 return 0;
}


int decode_packet(AVFormatContext *pFormatContext, AVPacket *pPacket, AVCodecContext *pCodecContext, AVFrame *pFrame, int64_t seek_target)
{
 if(av_seek_frame(pFormatContext, 0, /*(startTime + frameTimestamp) / 10*/seek_target, AVSEEK_FLAG_BACKWARD) < 0)
 {
 printf("error while seeking\n"/*, pFormatContext->filename*/);
 return -1;
 }
 avcodec_flush_buffers(pCodecContext);

 while(1)
 {
 if(av_read_frame(pFormatContext, pPacket) < 0)
 {
 logging("av_read_frame failure");
 break;
 }

 /* I'm not able to get to correct timestamp to discard prior frames upto desired seconds. This if hasn't worked out well as of now. */
 if((av_q2d(pFormatContext->streams[0]->time_base) * pPacket->pts) < (seek_target * 1000))
 {
 printf("skipping the frame\npFormatContext->streams[0]->time_base: %d %d\tpckt.pts: %lu\tseek: %lu", pFormatContext->streams[0]->time_base.num, pFormatContext->streams[0]->time_base.den, pPacket->pts, seek_target);
 av_packet_unref(pPacket);
 continue;
 }

 // Send Packet for decoding
 int response = avcodec_send_packet(pCodecContext, pPacket);

 if (response < 0) {
 logging("Error while sending a packet to the decoder: %s", av_err2str(response));
 return response;
 }

 while (response >= 0)
 {
 response = avcodec_receive_frame(pCodecContext, pFrame);
 if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
 break;
 } else if (response < 0) {
 logging("Error while receiving a frame from the decoder: %s", av_err2str(response));
 return response;
 }

 if (response >= 0) {
 logging(
 "Frame %d (type=%c, size=%d bytes, format=%d) pts %d key_frame %d [DTS %d]: %d",
 pCodecContext->frame_number,
 av_get_picture_type_char(pFrame->pict_type),
 pFrame->pkt_size,
 pFrame->format,
 pFrame->pts,
 pFrame->key_frame,
 pFrame->coded_picture_number,
 pPacket->dts
 );

 char frame_filename[1024];
 snprintf(frame_filename, sizeof(frame_filename), "%s-%d.pgm", "im/frame", pCodecContext->frame_number);

 if (pFrame->format != AV_PIX_FMT_YUV420P)
 {
 logging("Warning: the generated file may not be a grayscale image, but could e.g. be just the R component if the video format is RGB");
 }
 // save a grayscale frame into a .pgm file
 save_gray_frame(pFrame->data[0], pFrame->linesize[0], pFrame->width, pFrame->height, frame_filename);

 av_frame_unref(m_pAVFrame);
 
 }
 }
 }
 return 0;
}





-
Senior Software Engineer for Enterprise Analytics Platform
28 janvier 2016, par Matthieu Aubry — UncategorizedWe’re looking for a lead developer to work on Piwik Enterprise Analytics core platform software. We have some exciting challenges to solve and need you !
You’ll be working with both fellow employees and our open-source community. Piwik staff lives in New Zealand, Europe (Poland, Germany) and in the U.S. We do the vast majority of our collaboration online.
We are a small, flexible team, so when you come aboard, you will play an integral part in engineering. As a leader you’ll help us to prioritise work and grow our community. You’ll help to create a welcoming environment for new contributors and set an example with your development practices and communications skills. You will be working closely with our CTO to build a future for Piwik.
Key Responsibilities
- Strong competency coding in PHP and JavaScript.
- Scaling existing backend system to handle ever increasing amounts of traffic and new product requirements.
- Outstanding communication and collaboration skills.
- Drive development and documentation of internal and external APIs (Piwik is an open platform).
- Help make our development practices better and reduce friction from idea to deployment.
- Mentor junior engineers and set the stage for personal growth.
Minimum qualifications
- 5+ years of experience in product development, security, usable interface design.
- 5+ years experience building successful production software systems.
- Strong competency in PHP5 and JavaScript application development.
- Skill at writing tests and reviewing code.
- Strong analytical skills.
Location
- Remote work position !
- or you can join us in our office based in Wellington, New Zealand or in Wrocław, Poland.
Benefits
- Competitive salary.
- Remote work is possible.
- Yearly meetup with the whole team abroad.
- Be part of a successful open source company and community.
- In our Wellington (NZ) and Wroclaw (PL) offices : snacks, coffee, nap room, Table football, Ping pong…
- Regular events.
- Great team of people.
- Exciting projects.
Learn more
Learn more what it’s like to work on Piwik in our blog post
About Piwik
At Piwik we develop the leading open source web analytics platform, used by more than one million websites worldwide. Our vision is to help the world liberate their analytics data by building the best open alternative to Google Analytics.
The Piwik platform collects, stores and processes a lot of information : hundreds of millions of data points each month. We create intuitive, simple and beautiful reports that delight our users.
Apply online
To apply for this position, please Apply online here. We look forward to receiving your applications !
-
Java, serve HLS live video streams
12 février 2016, par momoI know the topic is not an easy one, but I am looking for a Java class to send an HLS stream from the server to the client.
I have files being generated greater and greater :
out.m3u8
out0.ts
out1.ts
out2.ts
out3.ts
out4.ts
out5.ts
out6.tsThis is generated using ffmpeg from an original source :
ffmpeg -i http://sourceurl.com:9981/stream/channel/1232131 out.m3u8
I can play it using VLC.
Somehow, I need to stream this live to the clients.
At this point, I do not really care about different bit rates, i just want live streaming to work, in mobile browsers and on desktop browsers.
I found this class :
https://github.com/Red5/red5-hls-plugin/blob/master/plugin/src/main/java/org/red5/stream/http/servlet/PlayList.java
Which might be doing something like that.
I have pulled in hls.js into my application in hopes of using it for desktops.
HLS should however work IOS devices without hls.js right now.
How should one serve HLS content from the server ? It’s very difficult to find any good and simple example to do that.
Anyone knows of the steps needed to do that ?
I’ve looked into Wowza and Red5 just a little bit, but unsure what they can provide for me at this stage and seems to be overly complicated to setup just to serve some files. But please explain to me why that’s not the case.