Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (20)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (5105)

  • ffmpeg include issue - some functions are missing

    27 septembre 2019, par Thomas Ayoub

    I try to follow and adapt this example to convert a video thanks to FFMPEG but some function seems to be missing like :

    int avcodec_open ( AVCodecContext * avctx, AVCodec * codec)    

    When I go in the doc to see where it come from, I find it in the file libavcodec/avcodec.h which is included in my program #include "libavcodec/avcodec.h" (in the top of my .h file).

    Given this, I don’t understand why Qt throw me this error :

    ../../Dev/Joker/libs/PhVideo/PhVideoEncoder.cpp:360:6: error: use of undeclared identifier 'avcodec_open'
       if (avcodec_open(c, codec) < 0) {
  • 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
  • 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());
           }
       }