Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (43)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP 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" (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (5439)

  • Place two videos side by side using ffmpeg ?and download it as one file

    5 août 2019, par marceloo1223

    I have two video files, which I want to play side by side and download them later. I used FFMPEG to merge them as one :

    protected void combinetwovideo()
    {
       string strParam;
       string Path_FFMPEG = Path.Combine(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["FFMpegPath"]));
       string apppath=HttpRuntime.AppDomainAppPath;
       //Merging two videos              
       String video1=apppath+"\\recordings\\client2019-08-03 02_23_59";
       String video2 =apppath+"\\userrecord\\User2019-08-03 02_24_00";
       String strResult =apppath+"\\RESULT\\";
       strParam = string.Format("-i ('" + video1 + "') -i ('" + video2 + "') -filter_complex \'[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' /-map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4");
       process(Path_FFMPEG, strParam);
    }
    public void process(string Path_FFMPEG, string strParam)
    {
       try
       {
           Process ffmpeg = new Process();
           ProcessStartInfo ffmpeg_StartInfo = new ProcessStartInfo(Path_FFMPEG, strParam);
           ffmpeg_StartInfo.UseShellExecute = false;
           ffmpeg_StartInfo.RedirectStandardError = true;
           ffmpeg_StartInfo.RedirectStandardOutput = true;
           ffmpeg.StartInfo = ffmpeg_StartInfo;
           ffmpeg_StartInfo.CreateNoWindow = true;
           ffmpeg.EnableRaisingEvents = true;
           ffmpeg.Start();
           ffmpeg.WaitForExit();
           ffmpeg.Close();
           ffmpeg.Dispose();
           ffmpeg = null;
       }
       catch (Exception ex)
       {
       }
    }

    But this method outputs nothing and does not throw any errors. I’m confused about the strParam query. Did I write it wrong or am I missing something. Any help would be apreciated.

  • How can I re-encode video frames to another codec using ffmpeg ?

    24 juillet 2019, par Pedro Constantino

    I am trying to learn ffmpeg, so I started a small project where I am sending an MP4 video stream to my C# application where I want to re-encode the video to webM and send it to an icecast server.

    My icecast server is receiving the video but I am not able to reproduce it (the video time is updated each time I press play but the video doesn’t play and I only see a black frame)

    Anyone can help me ? I have no idea of what is wrong in my code.

    My code execution flow is openInput->openOutput->streamingTest

      private void openInput()
       {
           _pInputFormatContext = ffmpeg.avformat_alloc_context();

           var pFormatContext = _pInputFormatContext;
           ffmpeg.avformat_open_input(&pFormatContext, configuration.Source, null, null).ThrowExceptionIfError();

           ffmpeg.avformat_find_stream_info(_pInputFormatContext, null).ThrowExceptionIfError();

           // find the first video stream
           for (var i = 0; i < _pInputFormatContext->nb_streams; i++)
               if (_pInputFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO)
               {
                   pInputStream = _pInputFormatContext->streams[i];
                   break;
               }

           if (pInputStream == null) throw new InvalidOperationException("Could not found video stream.");

           _inputStreamIndex = pInputStream->index;
           _pInputCodecContext = pInputStream->codec;

           var codecId = _pInputCodecContext->codec_id;
           var pCodec = ffmpeg.avcodec_find_decoder(codecId);
           if (pCodec == null) throw new InvalidOperationException("Unsupported codec.");

           ffmpeg.avcodec_open2(_pInputCodecContext, pCodec, null).ThrowExceptionIfError();

           configuration.CodecName = ffmpeg.avcodec_get_name(codecId);
           configuration.FrameSize = new Size(_pInputCodecContext->width, _pInputCodecContext->height);
           configuration.PixelFormat = _pInputCodecContext->pix_fmt;

           _pPacket = ffmpeg.av_packet_alloc();
           _pFrame = ffmpeg.av_frame_alloc();
       }


       private bool openOutput()
       {

           int ret;
           _pOutputFormatContext = ffmpeg.avformat_alloc_context();
           fixed (AVFormatContext** ppOutputFormatContext = &_pOutputFormatContext)
           {
               ret = ffmpeg.avformat_alloc_output_context2(ppOutputFormatContext, null, "webm", configuration.Destination);
               if (ret < 0)
               {
                   return false;
               }
           }

           AVOutputFormat* out_format = ffmpeg.av_guess_format(null, configuration.Destination, null);

           // Configure output video stream

           _pOutputStream = ffmpeg.avformat_new_stream(_pOutputFormatContext, null);

           AVStream* pInputVideoStream = null;

           for (var i = 0; i < _pInputFormatContext->nb_streams; i++)
           {
               if (_pInputFormatContext->streams[i]->codec->codec_type == AVMediaType.AVMEDIA_TYPE_VIDEO)
               {
                   pInputVideoStream = _pInputFormatContext->streams[i];
               }
           }

           ffmpeg.avcodec_parameters_copy(_pOutputStream->codecpar, pInputVideoStream->codecpar);

           _pOutputStream->codecpar->codec_type = AVMediaType.AVMEDIA_TYPE_VIDEO;
           _pOutputStream->codecpar->codec_id = AVCodecID.AV_CODEC_ID_VP8;

           AVDictionary* opt_dict;

           ffmpeg.av_dict_set(&opt_dict, "content_type", "video/webm", 0);
           ffmpeg.av_dict_set(&opt_dict, "user_agent", "GCS", 0);

           fixed (AVFormatContext** ppOutputFormatContext = &_pOutputFormatContext)
           {
               ret = ffmpeg.avio_open2(&_pOutputFormatContext->pb, configuration.Destination, ffmpeg.AVIO_FLAG_WRITE, null, &opt_dict);
               if (ret < 0)
               {
                   return false;
               }
           }

           ret = ffmpeg.avformat_write_header(_pOutputFormatContext, null);

           if (ret < 0)
           {
               return false;
           }

           ffmpeg.av_dump_format(_pOutputFormatContext, 0, configuration.Destination, 1);

           return true;
       }


       private unsafe void streamingTest(object gggg)
       {
           isStreamUp = true;

           AVPacket frame = new AVPacket();
           AVPacket* pFrame = &frame;
           ffmpeg.av_init_packet(pFrame);
           updateState(VideoStreamStates.Streaming);

           try
           {
               long start_time = ffmpeg.av_gettime();
               DateTime lastFrame = DateTime.MinValue;
               while (isStreamUp)
               {
                   if (cancelationToken.IsCancellationRequested)
                   {
                       throw new TaskCanceledException();
                   }

                   try
                   {
                       int error;
                       isReadingFrame = true;
                       do
                       {
                           error = ffmpeg.av_read_frame(_pInputFormatContext, pFrame);
                           if (error == ffmpeg.AVERROR_EOF)
                           {
                               frame = *pFrame;
                               continue;
                           }

                           error.ThrowExceptionIfError();
                       } while (frame.stream_index != _inputStreamIndex);

                       isWritingFrame = true;
                       //frame.stream_index = _outputStreamIndex;
                       _pOutputCodecContext = ffmpeg.avcodec_alloc_context3(_pOutputFormatContext->video_codec);

                       int ret = 0;
                       while (ret >= 0)
                       {
                           ret = ffmpeg.avcodec_receive_packet(_pOutputCodecContext, pFrame);
                       }

                       //ffmpeg.avcodec_send_frame(_pOutputCodecContext, pFrame);
                       //ffmpeg.avcodec_send_packet(_pOutputCodecContext, pFrame);

                       ret = ffmpeg.av_write_frame(_pOutputFormatContext, pFrame);

                       isWritingFrame = false;

                       if (frame.stream_index == _inputStreamIndex)
                       {
                           if (ret < 0)
                           {
                               Console.WriteLine("Missed frame");
                               missedFrames++;
                           }
                           else
                           {
                               Console.WriteLine("Sent frame");
                               sentFrames++;
                           }

                           AVRational time_base = _pInputFormatContext->streams[_inputStreamIndex]->time_base;
                           AVRational time_base_q = new AVRational();
                           time_base_q.num = 1;
                           time_base_q.den = ffmpeg.AV_TIME_BASE;

                           long pts_time = ffmpeg.av_rescale_q(frame.dts, time_base, time_base_q);
                           //long pts_time = ffmpeg.av_rescale_q(frame.dts, time_base_q, time_base);
                           long now_time = ffmpeg.av_gettime() - start_time;
                           if (pts_time > now_time)
                               ffmpeg.av_usleep((uint)(pts_time - now_time));
                       }
                       else
                           Console.WriteLine("????");
                   }
                   catch (Exception ex)
                   {
                       Console.WriteLine("Erro ao enviar: " + ex.Message);
                   }
                   finally
                   {
                       ffmpeg.av_packet_unref(pFrame);
                   }
               }
           }
           catch (TaskCanceledException)
           {
               updateState(VideoStreamStates.Stopped);
           }
           catch (Exception e)
           {
               Console.WriteLine(e.Message.ToString());
           }
       }
  • FFmpeg - Check if folder contains a matching filename with 2 different extensions and ignore both files. Process only filenames with 1 extension

    9 septembre 2019, par slyfox1186

    I need to batch convert all mkv files in a folder recursively to mp4.

    If a filename exists and matches both extensions, ignore both files and process only filenames that contain mkv, without matching mp4.

    Example : cat.mkv exists in folder with cat.mp4 = ignore both files

    Example : cat.mkv exists in folder and cat.mp4 does not = process cat.mkv to cat.mp4

    I have included a script that doesn’t work well. It processes all mkv files and mp4 files. The mp4 files throw an error as FFmpeg will not encode the same format in this manner over itself.

    As always thank you to anyone who might have a few ideas.

    UPDATE : I may have gotten it to work. I changed a few things from the original. If anyone has success or an idea to improve I’m all ears. Thanks.

    VERSION 2

    @ECHO ON
    SETLOCAL
    PROMPT $G
    COLOR 0A

    REM Set FFmpeg.exe location if not in system PATH already
    SET FF=C:\MAB\local64\bin-video\ffmpeg.exe

    REM Set MKV files root folder to recursively search
    SET "mkvPATH=C:\Encoding\1_Original\Test\"

    REM Change into mkvPATH DIR
    CD "C:\Encoding\1_Original\Test"

    REM Set temp file name
    SET TEMPFILE=convert_mkv.bat

    REM Create empty convert file
    COPY NUL "%TEMPFILE%" >NUL 2>&1

    REM ADD @ECHO OFF to top of blank convert_mkv.bat script
    ECHO @ECHO OFF >>"%TEMPFILE%"

    REM Recursively search MKV root folder
    FOR /R "%mkvPATH%" %%G IN (*.mkv *.mp4) DO (
       SET "GPATH=%%~fG"
       SET "GNAME=%%~nG"
       SETLOCAL ENABLEDELAYEDEXPANSION

       REM Ignore all files that have both
       REM extensions ".mkv" and ".mp4" in the file name
       IF "%%~nG.mkv"=="%%~nG.mkv" (
           IF NOT EXIST "%%~nG.mp4" (
               CALL :DO_FFmpeg "!GPATH!"
               IF "%%~nG.mkv"=="%%~nG.mkv" (
                   IF EXIST "%%~nG.mp4" (
                       ECHO(>>"%TEMPFILE%"
                   ) ELSE ENDLOCAL
               )
           )
       )
    )
    GOTO END

    REM CALL variables for use in FFmpeg's command line
    :DO_FFmpeg
    IF "%~1"=="" GOTO :END
    FOR %%I IN ("%~1") DO (
       SET "FOLDER=%%~dpI"
       SET "NAME=%%~nxI"
    )

    REM Export info to "%TEMPFILE% and RUN ffmpeg.exe's command line in the cmd.exe window
    ECHO %FF% -y -i "%~1" -ss 0 -t 300 -codec copy "%FOLDER%%~n1.mp4">>"%TEMPFILE%" && %FF% | %FF% -y -i "%~1" -ss 600 -t 30 -codec copy "%FOLDER%%~n1.mp4"

    :END
    PAUSE
    EXIT /B