Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (98)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (11117)

  • How to run Process one by one in a loop ?

    2 juin 2023, par TSLee

    I am trying to pass a file path to the Process in a for loop and let ffmpeg.exe read only one video file's format each time. However, it stops after the textbox's text contains the first video's content. I have tried process.close(), process.hasExited, etc, but those couldn't stop the program from starting more than one Process and caused the delegate massively updated the textbox (the outputs weren't listed in the right order and I couldn't tell which lines belong to which video, and a few outputs were missing or showing twice in the text). How to execute only one process each time before the next in a for loop ?

    


                foreach (String file in inputList)
            {
                if (flag == true)
                {
                    flag = false;
                    //textBox1.Text += file + Environment.NewLine;
                    checkvideoFormat(file);
                }

            }
            
            

        }
        catch (Exception err)
        {
            MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
    private void checkvideoFormat(String filePath)
    {
        Process process1 = new Process();
        process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process1.StartInfo.CreateNoWindow = true;
        process1.StartInfo.UseShellExecute = false;
        process1.StartInfo.FileName = ".\\ffmpeg.exe";
        process1.StartInfo.WorkingDirectory = ".\\";
        process1.EnableRaisingEvents = true;
        process1.StartInfo.RedirectStandardOutput = true; //if this is true, UseShellExecute must be false. true if output should be written to StandardOutput
        process1.StartInfo.RedirectStandardError = true;
        //indicates that the associated Process has written a line that's terminated with a newline
        process1.ErrorDataReceived += new DataReceivedEventHandler(inputHandler);
        
        process1.Exited += (ending, p) =>
        {
            flag = true;
            Console.WriteLine(flag);
            //textBox1.Text += "Hey " + file + Environment.NewLine;
            //process1.CancelOutputRead();
            //process1.CancelErrorRead();//
        };
        
        process1.StartInfo.Arguments = "-i " + " \"" + filePath + "\"";
        Console.WriteLine(process1.StartInfo.Arguments);
        process1.Start();
        process1.BeginOutputReadLine();
        process1.BeginErrorReadLine();
        //process1.Close();
        //process1.WaitForExit();
        /*
        if(process1.HasExited == true)
        {
            //process1.Refresh();
            flag = true;
            //process1.Close();
            //process1.Kill();
            Thread.Sleep(1000);
        }
        */
    }



    int test_123 = 0;
    private void inputHandler(object sender, DataReceivedEventArgs l)
    {
        cba.Append(test_123 + l.Data + "\n");
        videoInput = test_123 + l.Data + Environment.NewLine;
        //Console.WriteLine(cba);
        //Process p = sender as Process;
        Console.WriteLine(videoInput);
        
        this.Invoke(new MethodInvoker(() =>
        {

            if (!String.IsNullOrEmpty(videoInput))
            {
                textBox1.Text += videoInput;
            }

        }));

        test_123++;

    }


    


  • C# Process in loop reading error output, causes "No async read operation is in progress on the stream" error

    29 mai 2023, par TSLee

    I am trying to read the format of multiple video files using ffmpeg in an asynchronous operation of Process and facing an error, "No async read operation is in progress on the stream". According to https://social.msdn.microsoft.com/Forums/vstudio/en-US/c961f461-7afb-4a92-b0ae-f78c2003b5de/help-an-asynchronous-read-operation-is-already-in-progress-on-the-standardoutput-stream?forum=csharpgeneral, I think I have to use CancelErrorRead(), as BeginErrorReadLine() can't be launched more than once. I also wonder if I use this function in the wrong place, because the read operation has ended in process1.exited() ? But the operation can't proceed to the second index with this error.

    


    How could I use CancelErrorRead()/CancelOutputRead() properly and where should I place them on the code ? I also did an experiment in that I commented these two CancelRead(), and a different error "async read operation has been started on the stream" will appear.

    


                Process process1 = new Process();
            process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            process1.StartInfo.CreateNoWindow = true;
            process1.StartInfo.UseShellExecute = false;
            process1.StartInfo.FileName = ".\\ffmpeg.exe";
            process1.StartInfo.WorkingDirectory = ".\\";
            process1.EnableRaisingEvents = true;
            process1.StartInfo.RedirectStandardOutput = true; //if this is true, UseShellExecute must be false. true if output should be written to StandardOutput
            process1.StartInfo.RedirectStandardError = true;
            //indicates that the associated Process has written a line that's terminated with a newline
            process1.ErrorDataReceived += new DataReceivedEventHandler(inputHandler);
            process1.Exited += (ending, p) =>
            {
                flag = true;
                process1.CancelOutputRead();
                process1.CancelErrorRead();//
            };
            foreach (String file in inputList)
            {
                if (flag == true)
                {
                    flag = false;
                    process1.StartInfo.Arguments = "-i " + " \"" + file + "\"";
                    Console.WriteLine(process1.StartInfo.Arguments);
                    process1.Start();
                    process1.BeginOutputReadLine();//
                    process1.BeginErrorReadLine();
                    process1.WaitForExit(); //for asynchronous output
                }


            }
        }
        private void inputHandler(object sender, DataReceivedEventArgs l)
        {
             cba.Append(l.Data + "\n");
             videoInput = l.Data;
             //Console.WriteLine(cba);
             //Process p = sender as Process;
             Console.WriteLine(videoInput);

             this.BeginInvoke(new MethodInvoker(() =>
             {

              if (!String.IsNullOrEmpty(videoInput))
              {
                    if (videoInput.Contains("Stream #0:0"))
                    {
                        String subvideoInput1 = 
                        videoInput.Substring(videoInput.IndexOf("Stream #0:0"));
                        String video_inputType = subvideoInput1;
                        textBox1.Text += video_inputType + System.Environment.NewLine;
                        Console.WriteLine(video_inputType);
                     }
                     if (videoInput.Contains("Stream #0:1"))
                     {
                         String subvideoInput2 = 
                         videoInput.Substring(videoInput.IndexOf("Stream #0:1"));
                         Console.WriteLine(subvideoInput2.IndexOf("\n"));
                         Console.WriteLine(subvideoInput2);
                         String audio_inputType = subvideoInput2;
                         textBox1.AppendText(audio_inputType + System.Environment.NewLine);
                         Console.WriteLine(audio_inputType);
                     }
                     if (videoInput.Contains("Duration:"))
                     {
                         String videoinputDuration = 
                         videoInput.Substring(videoInput.IndexOf("Duration:"));
                         String subvideo_inputDuration = videoinputDuration.Substring(9);
                         String inputvideoDuration = 
                     subvideo_inputDuration.Remove(subvideo_inputDuration.IndexOf("."));
                         Console.WriteLine(inputvideoDuration);
                         double totalseconds = 
                         TimeSpan.Parse(inputvideoDuration).TotalSeconds;
                    
                    

                }
            }

        }));


    }


    


  • ffmpeg wont "gracefully" terminate using q or kill -2

    24 mai 2023, par Jeff Thompson

    I am trying to run a bash command on Ubuntu to pull video from a stream and make an .mp4 with it. Here is the command I am using.

    


    ffmpeg -rtsp_transport tcp -i 'rtsp://username:password!@ipaddress/?inst=1' -c copy -f segment -segment_time 180 -reset_timestamps 1 ipaddress_day_3_2_%d.mp4

    


    It connects and begins copying the stream fine, the issue comes with trying to stop the process. It states press [q] to stop, which does not work. I have also tried kill -2 pid and kill -15 pid. Where pid is the process id. However kill -9 pid works and ctrl+c works. The issue with killing it this way is it corrupts the .mp4 rendering it useless. This is the error I get when using ctrl+c or kill -9.

    


    av_interleaved_write_frame(): Immediate exit requested   [segment @ 0x56337ec42980] Failure occurred when ending segment 'ipaddress_day_3_2_0.mp4' Error writing trailer of ipaddress_day_3_2_0%d.mp4: Immediate exit requested

    


    One thing to note is pressing [q] did work once, when I first started working on this but has not since.

    


    Thank You.

    


    I have tried kill -2 pid, kill -15 pid and [q], which I expected to "gracefully" terminate it.
kill -9 pid and ctrl+c will forcefully terminate it but corrupt the file.