Recherche avancée

Médias (0)

Mot : - Tags -/presse-papier

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

Autres articles (53)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

  • 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 (5825)

  • PHP - Read and write the same file hangs

    2 février 2016, par Adracat

    I’m trying to use FFMPEG to make some works with video on the server, and something I need to do is to get the progress of the process.

    I searched a little and I found this solution which tells to write the log into a file and then reading and parsing it.

    The problem

    What is driving me crazy is that I tell FFMPEG - with exec - (process A) to write the log into a file, but when I try to read it - with file_get_contents() - (process B) it does not show the contents until process A is finished (or interrupted the PHP script).

    So, when process A finishes or it says "PHP script timeout", then I can read the file as times as I want, refreshing the page (process B) and showing the contents at the time.

    What I’ve tried

    I’ve tried to use fopen() to create the file with w, w+ and a parameters, using - and without using - fclose(). I’ve tried to use also flock() just in case it gets faster to read to process B if it knows it’s already locked and does not have to wait, but then FFMPEG is not able to write into the file.

    I’ve searched for multithreading too, but I think there must be an easier and simpler way.

    I’ve used also CURL and HTTP context, as this link suggests, but no luck.

    I’ve tried, too, to use PHP-FFMPEG but it’s not supporting the last FFMPEG version, so I cannot use it.

    When I said before "(or interrupted the PHP script)" is because I tried to wait and, when PHP got a timeout, process B worked alright and the file was still updating.

    The code

    Process A (fileA.php)

    exec('ffmpeg -y -i input_file.mp4 output_file.avi 2> C:\Full\Path\To\File\log.txt 1>&2');

    Process B (fileB.php)

    $content = file_get_contents($file);

    if($content){
       //get duration of source
       preg_match("/Duration: (.*?), start:/", $content, $matches);

       $rawDuration = $matches[1];

       //rawDuration is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawDuration));
       $duration = floatval($ar[0]);
       if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
       if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

       //get the time in the file that is already encoded
       preg_match_all("/time=(.*?) bitrate/", $content, $matches);

       $rawTime = array_pop($matches);

       //this is needed if there is more than one match
       if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

       //rawTime is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawTime));
       $time = floatval($ar[0]);
       if (!empty($ar[1])) $time += intval($ar[1]) * 60;
       if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

       //calculate the progress
       $progress = round(($time/$duration) * 100);

       echo "Duration: " . $duration . "<br />";
       echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%";

    }

    The process

    I just open fileA.php on a Chrome tab and, after a few seconds, I open fileB.php on another Chrome tab (and it stays as loading).

    What I need

    I need to be able to load the file and show the information I want to show while the file is being written (by exec and FFMPEG or other PHP scripts), so I can update the progress percentage with some AJAX calls.

    Extra information

    At this point, I’m using PHP 5.4 on a IIS 7.5 with Windows 7 Professional.

    Thank you everyone for your time, help and patience !

    Best regards.

  • Why my ffmpeg video encode codes does not work on other computer ?

    10 avril 2022, par Object Unknown

    I'm writing code to encode some cv::Mat images to a MP4 video. The program can run successfully in my computer which I developed it, but when I copied it (and all dlls it needs) to an other computer, it stopped work.

    &#xA;

    The function which reporting error : (I got it from StackOverflow, and added some changes)

    &#xA;

    int uns::VideoWriter::Remux()&#xA;{&#xA;    AVFormatContext* ifmt_ctx = NULL, * ofmt_ctx = NULL;&#xA;    int err = 0, ret = 0;&#xA;    int64_t ts = 0;&#xA;    AVStream* inVideoStream = NULL;&#xA;    AVStream* outVideoStream = NULL;&#xA;    if ((err = avformat_open_input(&amp;ifmt_ctx, VIDEO_TMP_FILE.c_str(), 0, 0)) &lt; 0)&#xA;    {&#xA;        if(callback != nullptr) &#xA;            callback("[uns::VideoWriter/Remux] Failed to open input file for remuxing", err);&#xA;        ret = -1;&#xA;        goto end;&#xA;    }&#xA;    if ((err = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) &#xA;    {&#xA;        if(callback != nullptr) &#xA;            callback("[uns::VideoWriter/Remux] Failed to retrieve input stream information", err);&#xA;        ret = -2;&#xA;        goto end;&#xA;    }&#xA;    if ((err = avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, FINAL_FILE_NAME.c_str())))&#xA;    {&#xA;        if(callback != nullptr) &#xA;            callback("[uns::VideoWriter/Remux] Failed to allocate output context", err);&#xA;        ret = -3;&#xA;        goto end;&#xA;    }&#xA;    inVideoStream = ifmt_ctx->streams[0];&#xA;    outVideoStream = avformat_new_stream(ofmt_ctx, NULL);&#xA;    if (!outVideoStream) &#xA;    {&#xA;        if(callback != nullptr) &#xA;            callback("[uns::VideoWriter/Remux] Failed to allocate output video stream", 0);&#xA;        ret = -4;&#xA;        goto end;&#xA;    }&#xA;    outVideoStream->time_base = { 1, fps };&#xA;    if ((err = avcodec_parameters_copy(outVideoStream->codecpar, inVideoStream->codecpar)) &lt; 0)&#xA;    {&#xA;        if (callback != nullptr)&#xA;            callback("[uns::VideoWriter/Remux] Failed to copy stream information", err);&#xA;        return -4;&#xA;        goto end;&#xA;    }&#xA;    outVideoStream->codecpar->codec_tag = 0;&#xA;    if (!(ofmt_ctx->oformat->flags &amp; AVFMT_NOFILE)) &#xA;    {&#xA;        if ((err = avio_open(&amp;ofmt_ctx->pb, FINAL_FILE_NAME.c_str(), AVIO_FLAG_WRITE)) &lt; 0)&#xA;        {&#xA;            if(callback != nullptr) &#xA;                callback("[uns::VideoWriter/Remux] Failed to open output file", err);&#xA;            ret = -5;&#xA;            goto end;&#xA;        }&#xA;    }&#xA;    ofmt_ctx->streams[0]->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    ofmt_ctx->streams[0]->time_base.num = 1;&#xA;    ofmt_ctx->streams[0]->time_base.den = fps;&#xA;    if ((err = avformat_write_header(ofmt_ctx, 0)) &lt; 0) &#xA;    {&#xA;        if(callback != nullptr) &#xA;            callback("[uns::VideoWriter/Remux] Failed to write header to output file", err);&#xA;        ret = -6;&#xA;        goto end;&#xA;    }&#xA;    AVPacket videoPkt;&#xA;    while (true) &#xA;    {&#xA;        if ((err = av_read_frame(ifmt_ctx, &amp;videoPkt)) &lt; 0) &#xA;        {&#xA;            break;&#xA;        }&#xA;        videoPkt.stream_index = outVideoStream->index;&#xA;        videoPkt.pts = ts;&#xA;        videoPkt.dts = ts;&#xA;        videoPkt.duration = av_rescale_q(videoPkt.duration, inVideoStream->time_base, outVideoStream->time_base);&#xA;        ts &#x2B;= videoPkt.duration;&#xA;        videoPkt.pos = -1;&#xA;        if ((err = av_interleaved_write_frame(ofmt_ctx, &amp;videoPkt)) &lt; 0) &#xA;        {&#xA;            if(callback != nullptr) &#xA;                callback("[uns::VideoWriter/Remux] Failed to mux packet", err);&#xA;            av_packet_unref(&amp;videoPkt);&#xA;            break;&#xA;        }&#xA;        av_packet_unref(&amp;videoPkt);&#xA;    }&#xA;    av_write_trailer(ofmt_ctx);&#xA;end:&#xA;    if (ifmt_ctx) &#xA;    {&#xA;        avformat_close_input(&amp;ifmt_ctx);&#xA;    }&#xA;    if (ofmt_ctx &amp;&amp; !(ofmt_ctx->oformat->flags &amp; AVFMT_NOFILE)) &#xA;    {&#xA;        avio_closep(&amp;ofmt_ctx->pb);&#xA;    }&#xA;    if (ofmt_ctx) &#xA;    {&#xA;        avformat_free_context(ofmt_ctx);&#xA;    }&#xA;    return ret;&#xA;}&#xA;

    &#xA;

    Notes :

    &#xA;

    &#xA;

    callback is a function which prints error messsage and error code.

    &#xA;The error I recived is [uns::VideoWriter/Remux] Failed to write header to output file, error code: -22

    &#xA;

    &#xA;

    I want to know what is causing this and how to resolve it please.

    &#xA;

    Other Informations :

    &#xA;

    &#xA;

    Developing Env :

    &#xA;

    &#xA;

    OS : Windows 11 Professional Workstation build 22593.ni_release
    &#xA;IDE : Visual Studio 2022
    &#xA;ffmpeg : 4.4.1
    &#xA;Installed ffmpeg library :&#xA;ffmpeg[avcodec],ffmpeg[avdevice],ffmpeg[avfilter],ffmpeg[avfilter],ffmpeg[avformat],ffmpeg[openh264],ffmpeg[swresample],ffmpeg[swscale]
    &#xA;Compile Settings : x64 Release

    &#xA;

    &#xA;

    &#xA;

    &#xA;

    Running Env which causing error :

    &#xA;

    &#xA;

    OS : Windows Server 2019 DataCenter
    &#xA;With all dlls VS2022 copied to release folder

    &#xA;

    &#xA;

    &#xA;

  • Non-monotonous DTS in output stream 0:1

    4 mai 2018, par sana

    I’m using ffmpeg to get a video file on network .I get the sound live but I it get the video too late. The code I use on the receiver side is :

    ffmpeg -i rtsp://10.0.0.1:8554/test1.sdp -acodec copy -vcodec copy /home/sana/lab/mrp/test1.avi

    The code I use On the sender side is :

    cvlc -vvv /home/sana/lab/video-server1/1.avi --sout '#transcode{vcodec=h264,vb=3000,scale=Auto,acodec=mp3,ab=128,channels=2,samplerate=8000}:rtp{dst=10.0.0.2,port=1234,sdp=rtsp://10.0.0.1:8554/test1.sdp}'

    the error in the output of the ffmpeg command(on the receiver) is :

    [avi @ 0x521ba80] Non-monotonous DTS in output stream 0:1; previous: 196, current: 162; changing to 197. This may result in incorrect timestamps in the output file

    the errors in the input of the vlc command(on the sender) is :

       [0x7f6070000f58] x264 encoder warning: invalid DTS: PTS is less than DTS

       [0x7f608c0009b8] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 532 ms)
       [0x7f608c0009b8] main input error: ES_OUT_RESET_PCR called
       .
       .
       [mpeg4 @ 0x7f60700075a0] header damaged
       [0x7f6070000b08] avcodec generic warning: cannot decode one frame (4105 bytes)
       [mpeg4 @ 0x7f60700075a0] header damaged
       [0x7f6070000b08] avcodec generic warning: cannot decode one frame (4078 bytes

    )

    What does this actually mean and what can I do to prevent it from happening ?

    the ffmpeg version is 4.0-static and vlc version is VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28) and ubuntu version is 14.04.