Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (73)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

Sur d’autres sites (14256)

  • Video record with audio in wpf

    5 août 2022, par Kostas Kontaras

    I am developing a chat application in WPF .NET Framework 4.7.2.
I want to implement video recording functionality using the web camera of the PC.
Up to now, I have done this :
I use AForge.Video and AForge.Video.DirectShow to use the webcam and get the frames.
Aforge creates a new thread for every frame. I'm receiving where I save the image and pass it on the UI thread to show the image.

    


     private void Cam_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            //handle frames from camera
            try
            {
                //New task to save the bitmap (new frame) into an image
                Task.Run(() =>
                {
                    if (_recording)
                    {
                        
                        currentreceivedframebitmap = (Bitmap)eventArgs.Frame.Clone();
                        currentreceivedframebitmap.Save($@"{CurrentRecordingFolderForImages}/{imgNumber}-{guidName}.png", ImageFormat.Png);
                        imgNumber++;
                    }
                });
                //convert bitmap to bitmapImage to show it on the ui
                BitmapImage bi;
                CurrentFrame = new Bitmap(eventArgs.Frame);
                using (var bitmap = (Bitmap)eventArgs.Frame.Clone())
                {
                    bi = new BitmapImage();
                    bi.BeginInit();
                    MemoryStream ms = new MemoryStream();
                    bitmap.Save(ms, ImageFormat.Bmp);
                    bi.StreamSource = ms;
                    bi.CacheOption = BitmapCacheOption.OnLoad;
                    bi.EndInit();

                }
                bi.Freeze();
                Dispatcher.BeginInvoke(new ThreadStart(delegate
                {
                    imageFrames.Source = bi;
                }));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }


    


    When the record finishes i take the image and make the video using ffmpeg.

    


     public static void ImagesToVideo(string ffmpegpath, string guid, string CurrentRecordingFolderForImages, string outputPath, int frameRate, int quality, int avgFrameRate)
        {
            
            Process process;
            process = new Process
            {

                StartInfo = new ProcessStartInfo
                {
                    FileName = $@"{ffmpegpath}",
                    //-r framerate , vcodec video codec, -crf video quality 0-51
                    Arguments = $@" -r {frameRate} -i {CurrentRecordingFolderForImages}\%d-{guid}.png -r {avgFrameRate} -vcodec libx264 -crf {quality} -pix_fmt yuv420p  {outputPath}",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow = true,
                    RedirectStandardError = true
                },
                EnableRaisingEvents = true,

            };
            process.Exited += ExeProcess_Exited;
            process.Start();

            string processOutput = null;
            while ((processOutput = process.StandardError.ReadLine()) != null)
            {
                //TO-DO handle errors
                Debug.WriteLine(processOutput);
            }
        }


    


    For the sound i use Naudio to record it and save it

    


    waveSource = new WaveIn();&#xA;            waveSource.StartRecording();&#xA;            waveFile = new WaveFileWriter(AudioFilePath, waveSource.WaveFormat);&#xA;&#xA;            waveSource.WaveFormat = new WaveFormat(8000, 1);&#xA;            waveSource.DataAvailable &#x2B;= new EventHandler<waveineventargs>(waveSource_DataAvailable);&#xA;            waveSource.RecordingStopped &#x2B;= new EventHandler<stoppedeventargs>(waveSource_RecordingStopped);&#xA;&#xA;private void waveSource_DataAvailable(object sender, WaveInEventArgs e)&#xA;        {&#xA;            if (waveFile != null)&#xA;            {&#xA;                waveFile.Write(e.Buffer, 0, e.BytesRecorded);&#xA;                waveFile.Flush();&#xA;            }&#xA;        }&#xA;</stoppedeventargs></waveineventargs>

    &#xA;

    and then ffmpeg again to merge video with sound

    &#xA;

    public static void AddAudioToVideo(string ffmpegpath, string VideoPath, string AudioPath, string outputPath)&#xA;        {&#xA;            _videoPath = VideoPath;&#xA;            _audioPath = AudioPath;&#xA;            Process process;&#xA;&#xA;            process = new Process&#xA;            {&#xA;&#xA;                StartInfo = new ProcessStartInfo&#xA;                {&#xA;                    FileName = $@"{ffmpegpath}",&#xA;                    Arguments = $" -i {VideoPath} -i {AudioPath} -map 0:v -map 1:a -c:v copy -shortest {outputPath} -y",&#xA;                    UseShellExecute = false,&#xA;                    RedirectStandardOutput = true,&#xA;                    CreateNoWindow = true,&#xA;                    RedirectStandardError = true&#xA;                },&#xA;                EnableRaisingEvents = true,&#xA;&#xA;            };&#xA;            process.Exited &#x2B;= ExeProcess_Exited;&#xA;            process.Start();&#xA;&#xA;            string processOutput = null;&#xA;            while ((processOutput = process.StandardError.ReadLine()) != null)&#xA;            {&#xA;                // do something with processOutput&#xA;                Debug.WriteLine(processOutput);&#xA;            }&#xA;&#xA;        }&#xA;

    &#xA;

    Questions :

    &#xA;

      &#xA;
    1. Is there a better approach to achieve what im trying to do ?
    2. &#xA;

    3. My camera has 30 fps capability but i receive only 16 fps how could this happen ?
    4. &#xA;

    5. Sometimes video and sound are not synchronized.
    6. &#xA;

    &#xA;

    i created a sample project github.com/dinos19/WPFVideoRecorder

    &#xA;

  • Web socket disconnects early when ffmpeg finishes proccess

    26 septembre 2022, par seriously

    I am using ffmpeg to stream an mp4 video to an rtmp server then display in on the front end using websocket and the process works fine. The problem i'm having is once the video nears its end the web socket connection on the front end disconnects and video stops playing. This is happening because ffmpeg has finished pushing the stream but not all frames are displayed on the front end yet because of stream lag. How can I keep the web socket from disconnecting when ffmpeg finishes streaming so that the full video will be played ? Thanks in advance.

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    const ffmpegPath = require(&#x27;@ffmpeg-installer/ffmpeg&#x27;).path;&#xA;const fluent = require(&#x27;fluent-ffmpeg&#x27;);&#xA;fluent.setFfmpegPath(ffmpegPath);&#xA;&#xA;const executeFfmpeg = args => {&#xA;  let command = fluent().output(&#x27; &#x27;); // pass "Invalid output" validation&#xA;  command._outputs[0].isFile = false; // disable adding "-y" argument&#xA;  command._outputs[0].target = ""; // bypass "Unable to find a suitable output format for &#x27; &#x27;"&#xA;  command._global.get = () => { // append custom arguments&#xA;    return typeof args === "string" ? args.split(&#x27; &#x27;) : args;&#xA;  };&#xA;  return command;&#xA;};&#xA;&#xA;function streamVideo() {&#xA;  executeFfmpeg(`-re -i ${path.join(__dirname, &#x27;..&#x27;, &#x27;test.mp4&#x27;)} -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost:PORT/live/test`)&#xA;    .on(&#x27;start&#x27;, commandLine => console.log(&#x27;start&#x27;, commandLine))&#xA;    .on(&#x27;codecData&#x27;, codecData => console.log(&#x27;codecData&#x27;, codecData))&#xA;    .on(&#x27;error&#x27;, error => console.log(&#x27;error&#x27;, error))&#xA;    .on(&#x27;stderr&#x27;, stderr => console.log(&#x27;error&#x27;, error))&#xA;    .on(&#x27;end&#x27;, commandLine => console.log(&#x27;video_live end&#x27;, commandLine))&#xA;    .run();&#xA;}&#xA;&#xA;streamVideo()

    &#xD;&#xA;

    <code class="echappe-js">&lt;script src=&quot;https://cdn.bootcss.com/flv.js/1.5.0/flv.min.js&quot;&gt;&lt;/script&gt;&#xA;&#xA;&#xA;&#xA;&lt;script&gt;&amp;#xA;  if (flvjs.isSupported()) {&amp;#xA;    var streamElement = document.getElementById(&amp;#x27;streamElement&amp;#x27;);&amp;#xA;    var flvPlayer = flvjs.createPlayer({&amp;#xA;      type: &amp;#x27;flv&amp;#x27;,&amp;#xA;      url: &amp;#x27;ws://localhost:PORT/live/test.flv&amp;#x27;&amp;#xA;    });&amp;#xA;    flvPlayer.attachMediaElement(streamElement);&amp;#xA;    flvPlayer.load();&amp;#xA;    flvPlayer.play();&amp;#xA;  }&amp;#xA;&lt;/script&gt;

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    The node media server module starts an rtmp, http and web socket server.

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    const NodeMediaServer = require(&#x27;node-media-server&#x27;);&#xA;&#xA;const config = {&#xA;  rtmp: {&#xA;    port: 1935,&#xA;    chunk_size: 60000,&#xA;    gop_cache: true,&#xA;    ping: 30,&#xA;    ping_timeout: 60&#xA;  },&#xA;  http: {&#xA;    port: 8000,&#xA;    allow_origin: &#x27;*&#x27;&#xA;  }&#xA;};&#xA;&#xA;var nms = new NodeMediaServer(config)&#xA;nms.run();

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

  • How to record RTSP to mp4 10 mins segments directly into FTP server

    31 octobre 2022, par HridyanshNarwal888

    I want to record a tcp RTSP stream in 10mins segments continuously which can be done with ffmpeg but i don't have enough storage on the actual device and i have many space on my FTP server

    &#xA;

    and i have no idea how to do it i've tried some codes which are recording it perfectly but cant sync to ftp at the same time

    &#xA;

    here the older code that i'm using

    &#xA;

    ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.3:10554/tcp/av0_0 -f mp4 -t 60 ftp://my_ftp_url/%Y-%m-%d/%H-%M-%S.mp4  &#xA;but it gives the error

    &#xA;

    [mp4 @ 0x144ae00] muxer does not support non seekable output Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 --  Conversion failed! exit status 1

    &#xA;

    If this is not possible in this language or through ffmpeg then I've no problem to change language or packages.

    &#xA;

    Thanks in advance

    &#xA;