Recherche avancée

Médias (1)

Mot : - Tags -/iphone

Autres articles (103)

  • 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

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (8464)

  • PHP execute batch files to start recording ffmpeg and to kill ffmpeg

    28 février 2018, par Mitchell Day

    Hi was just wondering if anyone knows a way that i can run a batch file that contains multiple "start ffmpeg" commands, that allows me to kill it using a batch file at some random point in time.

    I have one batch that starts 4 videos recording from a rtsp feed to file. And another one that taskkills that ffmpeg process. The problem is that i can run these successfully by running in cmd prompt, but when i try to use exec(record.bat) or popen() etc, it runs the ffmpeg process in the background, and the stoprecord.bat can’t kill it error is :

    The Process with PID x <child process="process" of="of" pid="pid" y="y"> could not be terminated.


    Reason: This Process can only be termintated forcefully (with /f option)
    </child>

    I don’t want to force it, because the mp4 file corrupts when you force close it. When i run the bat files directly i dont need that force option. I have tried giving the folders full permissions for the IIS_IUSRS user, i have made the bat and folder creater as IIS_IUSRS (thought the mkdir in the batch gives not permission to IIS usr which it is recording the video to).

    Any one have any clue why this wouldnt work. I have put the bat files below and the php script which calls them.

    Record.bat

    cd C:\inetpub\wwwroot\ESTF\batch
    tasklist /FI "IMAGENAME eq ffmpeg_sr.exe" | find ":" > NUL
    if errorlevel 1 exit
    set MEDIA_DIR=C:\inetpub\wwwroot\ESTF\media\recordings
    set WEB_DIR=C:\inetpub\wwwroot\estf\
    set VLC_DIR=C:\Program Files\VideoLAN\VLC
    set ROOM=simroom
    set M=1
    set N=1
    set CURRENT_DAY=day1
    set FFMPEG_DIR=C:\inetpub\wwwroot\ESTF\ffmpeg\bin                
    call "date.bat"
    if not exist %MEDIA_DIR%\curDate.txt (
       mkdir %MEDIA_DIR%
       icacls %MEDIA_DIR% /grant Everyone:(f)
       echo %DATESTR%>%MEDIA_DIR%\curDate.txt
       echo %CURRENT_DAY%>%MEDIA_DIR%\curDay.txt
       goto :LOOP2
    )
    if exist %MEDIA_DIR%\curDate.txt (
       set /p STORED_DATE=I %STORED_DATE%==%DATESTR% (
           set /p CURRENT_DAY=I NOT %STORED_DATE%==%DATESTR% (
       echo %DATESTR%>%MEDIA_DIR%\curDate.txt
       goto :LOOP1
    )

    :LOOP1
       set DAY_LOOP=%MEDIA_DIR%\day%M%
       if exist %DAY_LOOP% (
           set /a M = %M%+1
           goto :LOOP1
       )
       if not exist %DAY_LOOP% (
           mkdir %DAY_LOOP%
           icacls %DAY_LOOP% /grant Everyone:(f)
       )
       set CURRENT_DAY=day%M%
       @echo %CURRENT_DAY%>%MEDIA_DIR%\curDay.txt

    :LOOP2
       set CURRENT_ROOM=%MEDIA_DIR%\%CURRENT_DAY%\%ROOM%\Team%N%
       if exist %CURRENT_ROOM% (
           set /a N = %N%+1
           goto :LOOP2
       )
       if not exist %CURRENT_ROOM% (
           mkdir %CURRENT_ROOM%
           icacls %CURRENT_ROOM% /grant Everyone:(f)
       )

    cd %FFMPEG_DIR%

    echo %CURRENT_ROOM%>%MEDIA_DIR%\%CURRENT_DAY%\%ROOM%\teamNo.txt
    echo recording>%WEB_DIR%\srRecording.txt
    start ffmpeg_sr  -i rtsp://192.168.0.50:554/Streaming/Channels/1 -c:v copy -c:a libmp3lame -strict experimental "%CURRENT_ROOM%\1.mp4"
    start ffmpeg_sr  -i rtsp://192.168.0.51:554/Streaming/Channels/1 -c:v copy "%CURRENT_ROOM%\2.mp4"
    start ffmpeg_sr  -i rtsp://192.168.0.52:554/Streaming/Channels/1 -c:v copy "%CURRENT_ROOM%\3.mp4"
    start ffmpeg_sr  -i rtsp://192.168.0.21:554/Streaming/Channels/1 -c:v copy "%CURRENT_ROOM%\4.mp4"
    start ffmpeg_sr -f dshow -i audio="Microphone (High Definition Audio Device)" -c:a libmp3lame -strict experimental "%CURRENT_ROOM%\0.mp3"
    exit

    Stoprecord.bat

    taskkill /im ffmpeg_sr.exe /t
    set WEB_DIR=c:\inetpub\wwwroot\estf\
    set FFMPEG_DIR=C:\inetpub\wwwroot\ESTF\ffmpeg\bin\
    echo stopped>%WEB_DIR%\srRecording.txt
    set /p CURRENT_DAY=p CURRENT_ROOM= -i %CURRENT_ROOM%/0.mp3 -c:v copy -c:a copy -strict experimental -map 0:v:0 -map 1:a:0 %CURRENT_ROOM%/1.mp4
    ffmpeg -i %CURRENT_ROOM%/1_temp.mp4 -c:v copy -c:a copy -strict experimental -map 0:v:0 -map 1:a:0 %CURRENT_ROOM%/1.mp4
    REM del %CURRENT_ROOM%\1_temp.mp4
    del %CURRENT_ROOM%\0.mp3
    exit

    record.php

    &lt;?php
    echo exec('whoami');
    //$recordPath = 'c:\inetpub\wwwroot\estf\batch\srRecord.bat';
    //exec('c:\inetpub\wwwroot\estf\batch\srRecord.bat');
    $handle = popen('start c:\inetpub\wwwroot\estf\batch\srRecord.bat exit','r');
    pclose($handle);
    echo $handle;
    ?>

    stoprecord.php

    &lt;?php
    //exec('c:\inetpub\wwwroot\estf\batch\srRecordStop.exe /dev/null');
    $handle = popen('start c:\inetpub\wwwroot\estf\batch\srRecordStop.bat','r');
    pclose($handle);
    //die();
    echo $handle;
    ?>

    I have tried exec(), pclose(popen()), shell_exec(), tried adding /dev/nul & to both the php file and ffmpeg in the batch file.

    Regards,

    Mitchell

  • Compression Artifacts using sws_Scale() AVFrame YUV420p-> openCV Mat BGR24 and back

    8 septembre 2023, par Morph

    I transcode, using C++ and FFmpeg, an H264 video in an .mp4 container to H265 video in an .mp4 container. That works perfectly with crisp and clear images and encoding conversion confirmed by checking with FFprobe.

    &#xA;

    Then, I call one extra function in between the end of the H264 decoding and before the start of the H265 encoding. At that point I have an allocated AVFrame* that I pass to that function as an argument.

    &#xA;

    The function converts the AVFrame into an openCV cv::Mat and backwards. Technically that is the easy part, yet i encountered a compression artifact problem in the process of which i don't understand why it happens.

    &#xA;

    The function code (including a workaround for the question that follows) is as follows :

    &#xA;

    void modifyVideoFrame(AVFrame * frame)&#xA;{&#xA;    // STEP 1: WORKAROUND, overwriting AV_PIX_FMT_YUV420P BEFORE both sws_scale() functions below, solves "compression artifacts" problem;&#xA;    frame->format = AV_PIX_FMT_RGB24; &#xA;        &#xA;    // STEP 2: Convert the FFmpeg AVFrame to an openCV cv::Mat (matrix) object.&#xA;    cv::Mat image(frame->height, frame->width, CV_8UC3);&#xA;    int clz = image.step1();&#xA;&#xA;    SwsContext* context = sws_getContext(frame->width, frame->height, (AVPixelFormat)frame->format, frame->width, frame->height, AVPixelFormat::AV_PIX_FMT_BGR24, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    sws_scale(context, frame->data, frame->linesize, 0, frame->height, &amp;image.data, &amp;clz);&#xA;    sws_freeContext(context);&#xA;&#xA;    // STEP 3 : Change the pixels.&#xA;    if (false)&#xA;    {&#xA;        // TODO when "compression artifacts" problem with baseline YUV420p to BGR24 and back BGR24 to YUV420P is solved or explained and understood.&#xA;    }&#xA;    &#xA;    // UPDATE: Added VISUAL CHECK&#xA;    cv::imshow("Visual Check of Conversion AVFrame to cv:Map", image);&#xA;    cv::waitKey(20);&#xA;&#xA;    // STEP 4: Convert the openCV Mat object back to the FFmpeg AVframe.&#xA;    clz = image.step1();&#xA;    context = sws_getContext(frame->width, frame->height, AVPixelFormat::AV_PIX_FMT_BGR24, frame->width, frame->height, (AVPixelFormat)frame->format, SWS_FAST_BILINEAR, NULL, NULL, NULL);&#xA;    sws_scale(context, &amp;image.data, &amp;clz, 0, frame->height, frame->data, frame->linesize);&#xA;    sws_freeContext(context);&#xA;}&#xA;

    &#xA;

    The code as shown, including the workaround, works perfectly but is NOT understood.

    &#xA;

    Using FFprobe i established that the input pixel format is YUV420p which is indeed AV_PIX_FMT_YUV420p that is found in the frame format. If I convert it to BGR24 and back to YUV420p without the workaround in step 1, then i have slight compression artifacts but which are clearly visible when viewing with VLC. So there is a loss somewhere which is what I try to understand.

    &#xA;

    However, when I use the workaround in step 1 then I obtain the exact same output as if this extra function wasn't called (that is crisp and clear H265 without compression artifacts). To be sure that the conversion took place i modified the red value (inside the part of the code that now says if(false) ), and i can indeed see the changes when playing the H265 output file with VLC.

    &#xA;

    From that test it is clear that after the conversion of the input, data present in AVFrame, from YUV420P to cv::Map BGR24, all information and data needed to convert it back into the original YUV420P input data was available. Yet that is not what happens without the workaround, proven by the compression artifacts.

    &#xA;

    I used the first 17 seconds of the movie clip "Charge" encoded in H264 and available on the 'Blender' website.

    &#xA;

    Is there anyone that has some explanation or that can help me understand why the code WITHOUT the workaround does not nicely converts the input data forwards and then backwards back into the original input data.

    &#xA;

    This is what i see :&#xA;enter image description here

    &#xA;

    compared to what i see with work-around OR (update) Visual Check section (cv::imshow) IF part 4 of code is remarked :&#xA;enter image description here

    &#xA;

    These are the FFmpeg StreamingParams that i used on input :

    &#xA;

    copy_audio => 1&#xA;copy_video => 0&#xA;vid_codec => "libx265"&#xA;vid_video_codec_priv_key => "x265-params"&#xA;vid_codec_priv_value => "keyint=60:min-keyint=60:scenecut=0"&#xA;&#xA;// Encoder output&#xA;x265 [info]: HEVC encoder version 3.5&#x2B;98-753305aff&#xA;x265 [info]: build info [Windows][GCC 12.2.0][64 bit] 8bit&#x2B;10bit&#x2B;12bit&#xA;x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;x265 [info]: Main profile, Level-3.1 (Main tier)&#xA;x265 [info]: Thread pool 0 using 64 threads on numa nodes 0&#xA;x265 [info]: Slices                              : 1&#xA;x265 [info]: frame threads / pool features       : 1 / wpp(12 rows)&#xA;x265 [info]: Coding QT: max CU size, min CU size : 64 / 8&#xA;x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra&#xA;x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2&#xA;x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0&#xA;x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0&#xA;x265 [info]: References / ref-limit  cu / depth  : 3 / on / on&#xA;x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1&#xA;x265 [info]: Rate Control / qCompress            : ABR-2000 kbps / 0.60&#xA;x265 [info]: VBV/HRD buffer / max-rate / init    : 4000 / 2000 / 0.750&#xA;x265 [info]: tools: rd=2 psy-rd=2.00 rskip mode=1 signhide tmvp fast-intra&#xA;x265 [info]: tools: strong-intra-smoothing lslices=4 deblock sao&#xA;

    &#xA;

  • Optimize ffmpeg 2 pass command to speed up compression

    21 août 2022, par Khawar Raza

    In my android app, I am using ffmpeg wrapper library ffmpeg-kit. User is offered different file sizes and video file is compressed to the selected file size. I am using ffmpeg 2 pass command technique to compress video file to desired size. Here are the commands :

    &#xA;

     -y -i "input.mp4" -c:v h264 -b:v 8064k -s 1920x1440 -pass 1 -an -f mp4 -passlogfile "logfile.passlogfile" /dev/null&#xA;&#xA; -i "input.mp4" -c:v h264 -b:v 8064k -s 1920x1440 -pass 2 -c:a aac -b:a 128k -passlogfile "logfile.passlogfile" "outfile.mp4"&#xA;

    &#xA;

    Here file size 8064k and resolution 1920x1440 are dynamically set. It works for small video files but takes considerably high amount of time for large videos to finish the job. Can we optimize this process to complete it in less time ?

    &#xA;

    Note : The whole purpose of this process is to compress video to a desired file size where video quality will surely be compromised.

    &#xA;