Recherche avancée

Médias (1)

Mot : - Tags -/iphone

Autres articles (106)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

Sur d’autres sites (13968)

  • How do I set ffmpeg pipe output ?

    5 décembre 2019, par mr_blond

    I need to read ffmpeg output as pipe.
    There is a code example :

       public static void PipeTest()
       {
           Process proc = new Process();
           proc.StartInfo.FileName = Path.Combine(WorkingFolder, "ffmpeg");
           proc.StartInfo.Arguments = String.Format("$ ffmpeg -i input.mp3 pipe:1");
           proc.StartInfo.UseShellExecute = false;
           proc.StartInfo.RedirectStandardInput = true;
           proc.StartInfo.RedirectStandardOutput = true;
           proc.Start();

           FileStream baseStream = proc.StandardOutput.BaseStream as FileStream;
           byte[] audioData;
           int lastRead = 0;

           using (MemoryStream ms = new MemoryStream())
           {
               byte[] buffer = new byte[5000];
               do
               {
                   lastRead = baseStream.Read(buffer, 0, buffer.Length);
                   ms.Write(buffer, 0, lastRead);
               } while (lastRead > 0);

               audioData = ms.ToArray();
           }

           using(FileStream s = new FileStream(Path.Combine(WorkingFolder, "pipe_output_01.mp3"), FileMode.Create))
           {
               s.Write(audioData, 0, audioData.Length);
           }
       }

    It’s log from ffmpeg, the first file is readed :

    Input #0, mp3, from ’norm.mp3’ :
    Metadata :
    encoder : Lavf58.17.103
    Duration : 00:01:36.22, start : 0.023021, bitrate : 128 kb/s
    Stream #0:0 : Audio : mp3, 48000 Hz, stereo, fltp, 128 kb/s
    Metadata :
    encoder : Lavc58.27

    Then pipe :

    [NULL @ 0x7fd58a001e00] Unable to find a suitable output format for ’$’
    $ : Invalid argument

    If I run "-i input.mp3 pipe:1", the log is :

    Unable to find a suitable output format for ’pipe:1’ pipe:1 : Invalid
    argument

    How do I set correct output ? And how should ffmpeg know what the output format is at all ?

  • Video encoded by ffmpeg.exe giving me a garbage video in c# .net

    10 septembre 2018, par Amit Yadav

    I want to record video through webcam and file to be saved in .mp4 format. So for recording i am using AforgeNet.dll for recording and for mp4 format i am encoding raw video into mp4 using ffmpeg.exe using NamedPipeStreamServer as i receive frame i push into the named pipe buffer. this process works fine i have checked in ProcessTheErrorData event but when i stop recording the output file play garbage video shown in the image below

    enter image description here

    Here is Code for this

      Process Process;
     NamedPipeServerStream _ffmpegIn;
       byte[]  _videoBuffer ;
       const string PipePrefix = @"\\.\pipe\";
       public void ffmpegWriter()
       {
           if(File.Exists("outputencoded.mp4"))
           {
               File.Delete("outputencoded.mp4");
           }

           _videoBuffer = new byte[widht * heigth * 4];
           var audioPipeName = GetPipeName();
           var videoPipeName = GetPipeName();
           var videoInArgs = $@" -thread_queue_size 512 -use_wallclock_as_timestamps 1 -f rawvideo -pix_fmt rgb32 -video_size 640x480 -i \\.\pipe\{videoPipeName}";
           var videoOutArgs = $"-vcodec libx264 -crf 15 -pix_fmt yuv420p -preset ultrafast -r 10";
           _ffmpegIn = new NamedPipeServerStream(videoPipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0, _videoBuffer.Length);
           Process=StartFFmpeg($"{videoInArgs} {videoOutArgs} \"{"outputencoded.mp4"}\"", "outputencoded.mp4");
       }

    bool WaitForConnection(NamedPipeServerStream ServerStream, int Timeout)
       {
           var asyncResult = ServerStream.BeginWaitForConnection(Ar => { }, null);

           if (asyncResult.AsyncWaitHandle.WaitOne(Timeout))
           {
               ServerStream.EndWaitForConnection(asyncResult);

               return ServerStream.IsConnected;
           }

           return false;
       }
     static string GetPipeName() => $"record-{Guid.NewGuid()}";

    public static Process StartFFmpeg(string Arguments, string OutputFileName)
           {
               var process = new Process
               {
                   StartInfo =
                   {
                       FileName = "ffmpeg.exe",
                       Arguments = Arguments,
                       UseShellExecute = false,
                       CreateNoWindow = true,
                       RedirectStandardError = true,
                       RedirectStandardInput = true,

                   },
                   EnableRaisingEvents = true
               };

               //  var logItem = ServiceProvider.Get<ffmpeglog>().CreateNew(Path.GetFileName(OutputFileName));

               process.ErrorDataReceived += (s, e) => ProcessTheErrorData(s,e);

               process.Start();

               process.BeginErrorReadLine();

               return process;
           }
    </ffmpeglog>

    and Writing each frame like this.

    private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
           {

               try
               {
                   if (_recording)
                   {

                       using (var bitmap = (Bitmap) eventArgs.Frame.Clone())
                       {
                          var _videoBuffers = ImageToByte(bitmap);


                               if (_firstFrameTime != null)
                               {
                               bitmap.Save("image/" + DateTime.Now.ToString("ddMMyyyyHHmmssfftt")+".bmp");

                                   _lastFrameTask?.Wait();


                                   _lastFrameTask = _ffmpegIn.WriteAsync(_videoBuffers, 0, _videoBuffers.Length);
                               }
                               else
                               {
                                   if (_firstFrame)
                                   {
                                       if (!WaitForConnection(_ffmpegIn, 5000))
                                       {
                                           throw new Exception("Cannot connect Video pipe to FFmpeg");
                                       }

                                       _firstFrame = false;
                                   }

                                   _firstFrameTime = DateTime.Now;
                                   _lastFrameTask?.Wait();

                                   _lastFrameTask = _ffmpegIn.WriteAsync(_videoBuffers, 0, _videoBuffers.Length);

                               }

                       }
                   }
                   using (var bitmap = (Bitmap) eventArgs.Frame.Clone())
                   {
                       var bi = bitmap.ToBitmapImage();
                       bi.Freeze();
                       Dispatcher.CurrentDispatcher.Invoke(() => Image = bi);
                   }
               }
               catch (Exception exc)
               {
                   MessageBox.Show("Error on _videoSource_NewFrame:\n" + exc.Message, "Error", MessageBoxButton.OK,
                       MessageBoxImage.Error);
                   StopCamera();
               }
           }

    Even i have written each frame to disk as bitmap .bmp and frames are correct but i don’t know what’s i am missing here ? please help thanks in advance.

  • Stream with ffmpeg over LAN ?

    5 septembre 2018, par Kalpit

    I’m trying to stream a mpegts file over LAN, with the command

    ffmpeg -re -i in.ts -vcodec copy -acodec copy -f mpegts "udp://localhost:5000/live/stream"

    And trying to capture 10s chunks of it over LAN(at server) at

    ffmpeg  -i udp://192.168.xx.xx:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in /%Y-%m-%d_%H-%M-%S.mp4"

    This isn’t working. I tested the stream in VLC, and there’s nothing to play.

    Now, I suspect this is a port issue, since FFMPEG doesnt seem to write/listen over the 5000 port specified. I used netstat to check, and there are no PID including ffmpeg on the port. However, the command

    ffmpeg  -i udp://127.0.0.1:5000/live/stream -c copy -f segment -segment_time 10 -strftime 1 "in/%Y-%m-%d_%H-%M-%S.mp4"

    generates the desired output on my machine(localhost), as does ffplay. Can anyone help ?