Recherche avancée

Médias (91)

Autres articles (107)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (5473)

  • 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

  • Video file not trimming and copying using FFMpeg in C#

    15 mai 2019, par chapperzuk

    I am trying to clip a video using C# in Visual Studios with FFMpeg. I run the code below and it doesn’t come back with any errors, except it doesn’t create a new video file.

    I’ve looked around here to make sure I’m using the correct code, but after multiple attempts it still won’t copy.

    string videoFile = @"C:\Users\dave\Documents\video 1.mp4";
    string outputFile = @"C:\Users\dave\Documents\video 2.mp4";

    Process process = new Process();
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.FileName = @"C:\Users\dave\Documents\ffmpeg.exe";
    process.StartInfo.Arguments = "ffmpeg -i " + videoFile + " -ss 00:30:00 -t 00:00:10 -c copy " + outputFile;
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.CreateNoWindow = true;
    process.Start();

    I was expecting to get a video cut from the original video, starting at the 30 second mark and lasting 10 seconds, but nothing is created.

    I am using the latest FFMpeg from https://ffmpeg.zeranoe.com/builds/

    UPDATE If I run the code in command prompt - The file comes out corrupt though

    ffmpeg -i "C:\\Users\\dave\\Documents\\video 1.mp4" -ss 00:30:00 -t 00:00:10 -c copy "C:\\Users\\dave\\Documents\\video 2.mp4"
    ffmpeg version N-93851-gdcc999819d Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 8.3.1 (GCC) 20190414
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
     libavutil      56. 27.100 / 56. 27.100
     libavcodec     58. 52.101 / 58. 52.101
     libavformat    58. 27.103 / 58. 27.103
     libavdevice    58.  7.100 / 58.  7.100
     libavfilter     7. 51.100 /  7. 51.100
     libswscale      5.  4.101 /  5.  4.101
     libswresample   3.  4.100 /  3.  4.100
     libpostproc    55.  4.100 / 55.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\\Users\\dave\\Documents\\video 1.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2mp41
       creation_time   : 2019-01-15T21:57:04.000000Z
       title           : My Movie
       encoder         : Lavf56.15.102
       description     : This video is about My Movie
     Duration: 00:06:48.22, start: 0.000000, bitrate: 1283 kb/s
       Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1202 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 tbc (default)
       Metadata:
         creation_time   : 2019-01-15T21:57:04.000000Z
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
       Metadata:
         creation_time   : 2019-01-15T21:57:04.000000Z
         handler_name    : SoundHandler
    Output #0, mp4, to 'C:\\Users\\dave\\Documents\\video 2.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2mp41
       description     : This video is about My Movie
       title           : My Movie
       encoder         : Lavf58.27.103
       Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1202 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 11988 tbc (default)
       Metadata:
         creation_time   : 2019-01-15T21:57:04.000000Z
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 74 kb/s (default)
       Metadata:
         creation_time   : 2019-01-15T21:57:04.000000Z
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=    0 fps=0.0 q=-1.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
    video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
  • ffmpeg fails to convert an uploaded video file whose size greater than 14mb when executed through c#.net

    28 avril 2013, par Harun

    I am converting videos to flv using ffmpeg.exe through c# and the process gets stuck and the conversion fails if the file size exceeds 14mb. I've tried to run ffmpeg directly through command prompt and it works fine regardless of size.

    My conversion code is as follows :

    OutputFile = SavePath + "SWF\\" + WithOutExt + ".flv";
    FilArgs = string.Format("-i {0} -ar 22050 -qscale 1 {1}",InputFile,OutputFile);

    Process proc;
    proc = new Process();

    try
    {
        proc.StartInfo.FileName = spath + "\\ffmpeg\\ffmpeg.exe";
        proc.StartInfo.Arguments = FilArgs;
        proc.StartInfo.UseShellExecute = false;
        proc.StartInfo.CreateNoWindow = false;
        proc.StartInfo.RedirectStandardOutput = true;
        proc.StartInfo.RedirectStandardError = true;
        proc.Start();

        string StdOutVideo = proc.StandardOutput.ReadToEnd();
        string StdErrVideo = proc.StandardError.ReadToEnd();
    }
    finally
    {
        proc.WaitForExit();
        proc.Close();
    }

    When I tried to manually stop the running process The stderroutput is as follows :

    FFmpeg version SVN-r21231-Sherpya, Copyright (c) 2000-2010 Fabrice Bellard, et al.
    built on Jan 16 2010 05:42:31 with gcc 4.2.5 20080919 (prerelease) [Sherpya]
    libavutil 50. 7. 0 / 50. 7. 0
    libavcodec 52.47. 0 / 52.47. 0
    libavformat 52.47. 0 / 52.47. 0
    libavdevice 52. 2. 0 / 52. 2. 0
    libavfilter 1.15. 0 / 1.15. 0
    libswscale 0. 8. 0 / 0. 8. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C :\Project-Folder-Files\ThirtySecondPitch\video\7.mp_c88a8ec2-3a60-4133-aee6-7e2d93b62324.mp4' :
    Metadata :
    major_brand : isom
    minor_version : 512
    compatible_brands : isomiso2mp41
    Duration : 00:00:23.13, start : 0.000000, bitrate : 9261 kb/s
    Stream #0.0(jpn) : Video : mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 9128 kb/s, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1(jpn) : Audio : aac, 48000 Hz, stereo, s16, 127 kb/s
    Output #0, flv, to 'C :\Project-Folder-Files\ThirtySecondPitch\video\SWF\7.mp_c88a8ec2-3a60-4133-aee6-7e2d93b62324.flv' :
    Stream #0.0(jpn) : Video : flv, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 30 tbc
    Stream #0.1(jpn) : Audio : libmp3lame, 22050 Hz, stereo, s16, 64 kb/s
    Stream mapping :
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    Press [q] to stop encoding
    frame= 19 fps= 0 q=1.0 size= 596kB time=0.50 bitrate=9839.2kbits/s
    frame= 36 fps= 33 q=1.0 size= 1284kB time=1.07 bitrate=9822.2kbits/s
    frame= 55 fps= 34 q=1.0 size= 2076kB time=1.70 bitrate=10013.6kbits/s
    frame= 74 fps= 35 q=1.0 size= 2819kB time=2.35 bitrate=9822.2kbits/s
    frame= 93 fps= 35 q=1.0 size= 3583kB time=2.95 bitrate=9943.3kbits/s
    frame= 113 fps= 36 q=1.0 size= 4457kB time=3.63 bitrate=10056.2kbits/s
    frame= 132 fps= 36 q=1.0 size= 5157kB time=4.26 bitrate=9922.3kbits/s
    frame= 152 fps= 37 q=1.0 size= 5972kB time=4.91 bitrate=9961.6kbits/s
    frame= 172 fps= 37 q=1.0 size= 6817kB time=5.62 bitrate=9943.9kbits/s
    frame= 192 fps= 37 q=1.0 size= 7676kB time=6.27 bitrate=10030.1kbits/s
    frame= 212 fps= 37 q=1.0 size= 8488kB time=6.92 bitrate=10045.9kbits/s
    frame= 232 fps= 37 q=1.0 size= 9306kB time=7.58 bitrate=10062.8kbits/s
    frame= 251 fps= 37 q=1.0 size= 10150kB time=8.26 bitrate=10072.1kbits/s
    frame= 271 fps= 37 q=1.0 size= 10970kB time=8.88 bitrate=10117.6kbits/s
    frame= 291 fps= 38 q=1.0 size= 11815kB time=9.56 bitrate=10123.7kbits/s
    frame= 311 fps= 38 q=1.0 size= 12625kB time=10.24 bitrate=10100.1kbits/s
    frame= 331 fps= 38 q=1.0 size= 13414kB time=10.89 bitrate=10088.0kbits/s
    frame= 351 fps= 38 q=1.0 size= 14125kB time=11.55 bitrate=10021.7kbits/s
    frame= 371 fps= 38 q=1.0 size= 14929kB time=12.25 bitrate=9983.0kbits/s
    frame= 391 fps= 38 q=1.0 size= 15701kB time=12.90 bitrate=9967.8kbits/s
    frame= 411 fps= 38 q=1.0 size= 16385kB time=13.56 bitrate=9899.9kbits/s
    frame= 431 fps= 38 q=1.0 size= 17137kB time=14.21 bitrate=9878.7kbits/s
    frame= 451 fps= 38 q=1.0 size= 17938kB time=14.92 bitrate=9851.7kbits/s
    frame= 471 fps= 38 q=1.0 size= 18663kB time=15.57 bitrate=9820.0kbits/s
    frame= 491 fps= 38 q=1.0 size= 19379kB time=16.22 bitrate=9786.4kbits/s
    frame= 511 fps= 38 q=1.0 size= 20179kB time=16.90 bitrate=9780.9kbits/s
    frame= 530 fps= 38 q=1.0 size= 20893kB time=17.53 bitrate=9764.8kbits/s
    frame= 550 fps= 38 q=1.0 size= 21633kB time=18.18 bitrate=9747.3kbits/s
    frame= 570 fps= 38 q=1.0 size= 22464kB time=18.89 bitrate=9743.5kbits/s
    frame= 590 fps= 38 q=1.0 size= 23227kB time=19.54 bitrate=9737.7kbits/s
    frame= 609 fps= 38 q=1.0 size= 23992kB time=20.17 bitrate=9745.8kbits/s
    frame= 629 fps= 38 q=1.0 size= 24804kB time=20.85 bitrate=9747.4kbits/s
    frame= 648 fps= 38 q=1.0 size= 25501kB time=21.45 bitrate=9740.6kbits/s
    frame= 668 fps= 38 q=1.0 size= 26306kB time=22.13 bitrate=9739.7kbits/s
    frame= 687 fps= 38 q=1.0 size= 27040kB time=22.80 bitrate=9713.2kbits/s