
Recherche avancée
Médias (2)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (42)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (5396)
-
Access violation reading location when opening avfromat_open_input
28 mai 2023, par noklaI am trying to build a function for reading a video from .mp4 file using ffmpeg and c++.


This function was already working on one computer but when I copied the code to another one, with the same environment it returned the following error :


Exception thrown at 0x00007FFC81B7667C (avutil-57.dll)
in VideoEditor.exe: 0xC0000005: Access violation 
reading location 0x0000000000000000.



If anyone has ever encountered such an issue or have any idea how to solve it please share.



This is the function :


void VideoSource::ReadSource()
{
 auto lock = this->LockSource();
 std::vector> newSource;

 // Open the file using libavformat
 AVFormatContext* av_format_ctx = avformat_alloc_context();
 if (!av_format_ctx) {
 //wxMessageBox("Couldn't create AVFormatContext\n");
 read = false;
 return;
 }
 if (avformat_open_input(&av_format_ctx, path.c_str(), NULL, NULL) != 0) { // error here
 //wxMessageBox("Couldn't open video file\n");
 read = false;
 return;
 }

 // Find the first valid video stream inside the file
 int video_stream_index = -1;
 AVCodecParameters* av_codec_params = NULL;
 const AVCodec* av_codec = NULL;
 for (uint i = 0; i < av_format_ctx->nb_streams; i)
 {
 av_codec_params = av_format_ctx->streams[i]->codecpar;
 av_codec = avcodec_find_decoder(av_codec_params->codec_id);

 if (!av_codec) {
 continue;
 }
 if (av_codec_params->codec_type == AVMEDIA_TYPE_VIDEO) {
 video_stream_index = i;
 break;
 }
 }

 if (video_stream_index == -1) {
 //wxMessageBox("Couldn't find valid video stream inside file\n");
 read = false;
 return;
 }

 // Set up a codec context for the decoder
 AVCodecContext* av_codec_ctx = avcodec_alloc_context3(av_codec);
 if (!av_codec_ctx) {
 //wxMessageBox("Couldn't create AVCpdecContext\n");
 read = false;
 return;
 }

 if (avcodec_parameters_to_context(av_codec_ctx, av_codec_params) < 0)
 {
 //wxMessageBox("Couldn't initialize AVCodecContext\n");
 read = false;
 return;
 }
 if (avcodec_open2(av_codec_ctx, av_codec, NULL) < 0) {
 //wxMessageBox("Couldn't open codec\n");

 read = false;
 return;
 }

 AVFrame* av_frame = av_frame_alloc();
 if (!av_frame) {
 //wxMessageBox("Couldn't allocate AVFrame\n");

 read = false;
 return;
 }
 AVPacket* av_packet = av_packet_alloc();
 if (!av_packet) {
 //wxMessageBox("Couldn't allocate AVPacket\n");

 read = false;
 return;
 }
 int response;
 int counter = 0;
 while (av_read_frame(av_format_ctx, av_packet) >= 0 && counter < 100000) {
 if (av_packet->stream_index != video_stream_index) {
 av_packet_unref(av_packet);
 continue;
 }
 response = avcodec_send_packet(av_codec_ctx, av_packet);
 if (response < 0) {
 //wxMessageBox("Failed to decode packet: %s\n", av_err2str(response));

 read = false;
 return;
 }
 response = avcodec_receive_frame(av_codec_ctx, av_frame);
 if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
 av_packet_unref(av_packet);
 continue;
 }
 else if (response < 0) {
 //wxMessageBox("Failed to decode frame: %s\n", av_err2str(response));

 read = false;
 return;
 }
 counter++;
 av_packet_unref(av_packet);

 av_packet = av_packet_alloc();

 response = avcodec_send_frame(av_codec_ctx, av_frame);
 std::string tmp = av_err2str(response);
 //source.push_back(*av_frame);
 //auto mat_frame = Avframe2Cvmat(av_frame);

 //source.push_back(im);
 //bool isEqual = (cv::sum(Avframe2Cvmat(av_frame) != Avframe2Cvmat(&source[0])) == cv::Scalar(0, 0, 0, 0));
 //bool isEqual = (cv::sum(im != source[0]) == cv::Scalar(0, 0, 0, 0));
 //im.release();
 newSource.push_back(SyncObject(av_frame_clone(av_frame)));

 /*
 if (int iRet = av_frame_copy(&source.back(), av_frame) == 0) {
 av_log(NULL, AV_LOG_INFO, "Ok");
 }
 else {
 av_log(NULL, AV_LOG_INFO, "Error: %s\n", av_err2str(iRet));
 }*/
 av_frame_unref(av_frame);
 }


 avformat_close_input(&av_format_ctx);
 avformat_free_context(av_format_ctx);
 av_frame_free(&av_frame);
 av_packet_free(&av_packet);
 avcodec_free_context(&av_codec_ctx);
 //this->LockSource();
 source_.swap(newSource);
}



This function is inside A class and those are its memebers :


bool created;
 bool read;
 std::string path; // THE PATH TO THE FILE
 std::vector> source_; // vector containing all of the video frames





This is what I get in the debugger when the error accures :


[![Debugger values][1]][1]



-
fftools/ffmpeg : move opening decoders to a new file
11 avril 2023, par Anton Khirnov -
Why opening multiple ffmpeg.exe causes IIS stuck ?
24 mars 2023, par WenI've been working on this project for several months, trying to convert RTSP streams to JPEG images and send them back to the client. I'm using C# ProcessStartInfo and multipart/x-mixed-replace to achieve this goal. It worked well for only one camera. Unfortunately, I found that the IIS would deadlock after opening too many RTSP streams or maybe ffmepg.exe. After that, I must restart IIS, or the program cannot execute. I've been searching for the answer for more than three weeks. Here is part of my code :


public HttpResponseMessage GetVideo(int id){
 HttpResponseMessage response = Request.CreateResponse();
 var pushStreamContent = new PushStreamContent((stream, content, context) =>{
 this.stream = stream;
 FrameReader();
 });

 pushStreamContent.Headers.ContentType = 
 **System.Net.Http.Headers.MediaTypeHeaderValue.Parse("multipart/x-mixed-replace");**
 response.Content = pushStreamContent;
 return response;
 }



public async Task FrameReader(){
 ProcessStartInfo startInfo = new ProcessStartInfo{
 StandardErrorEncoding = Encoding.UTF8,
 FileName = ffmpegPath,
 **Arguments = $"-rtsp_transport tcp -timeout 1000000 -i {rtsp_url} -f image2pipe -"**,
 UseShellExecute = false,
 CreateNoWindow = true
 };

using (var ffmpegProcess = new Process { StartInfo = startInfo }){
 ffmpegProcess.Start();
 ffmpegProcess.BeginErrorReadLine();

 //Here is a portion related to image processing
 }

}



Really need some advices, thank you in advance !!!