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 (7099)

  • creating video from list of images using python and ffmpeg

    13 août 2019, par haseeb

    summary

    from given code, second function taking UI values and passing to first one. from log, first two lines shows command list and command string.

    whats irritating me is, if i copied second line from log(dos cmd) and paste it in a cmd prompt, it works successfully and produces video correctly. but running it via gui subprocess, errors out.

    TASK DESCRIPTION

    directory contains thousand of images each after few minutes of a contruction project. i need to create a video from data (images) per day basis.
    i have successfully extracted list of images etc and have data

    def framesToVideoViaCount(srcFile,outputFile,start,count,rate):
       # ffmpeg -start_number 1 -i test_%04d.png -vframes 100 -vcodec mpeg4 test.mp4
       # "C:\\Users\\lalat\\Desktop\\03008427633\\output_%04d.png"
       # ffmpeg -start_number 50 -i "C:\\Users\\lalat\\Desktop\\03008427633\\output_%04d.png" -vframes 200 -vcodec mpeg4 "C:\\Users\\lalat\\Desktop\\day1.mp4"
       command = [ 'ffmpeg',
                   # '-loglevel', 'fatal',
                   '-r %d' %(rate),
                   '-start_number %d' %(start) ,
                   '-i "%s"' %(srcFile),
                   '-vframes %d' %(count),
                   '-vcodec mpeg4' ]
       # command.append ('fps=%d' % (fps))
       command.append (outputFile)
       print ("COMMAND: " , command)
       print ("DOS CMD: ", ' '.join(command))
       ffmpeg = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
       out, err = ffmpeg.communicate()
       if(err) : print('error',err); return None;
       print (out)

    Actual GUI function call

    def approachByCount(self):
           tdate = datetime(year=int(self.fyear.get()), month=int(self.fmonth.get()), day=int(self.fdate.get()))
           # now = datetime.datetime.now()
           outputName = str(tdate.strftime("%Y%m%d")) + ".txt"
           outputVid = str(tdate.strftime("%Y%m%d")) + ".mp4"
           files = os.listdir(self.userDir)
           selected = []
           for afile in files:
               afile = os.path.join(self.userDir,afile)
               sdate = datetime.fromtimestamp(os.path.getmtime(afile))
               if sdate.date() == tdate.date():
                   selected.append(afile)
           # get first file name
           srcfilename = os.path.basename(selected[0])
           srcfilename,ext = srcfilename.split(".")
           filename,pad = srcfilename.split("_")
           srcfilename = os.path.join(self.userDir,filename+"_%0"+str(len(pad))+"d."+ext)
           start = int(pad)
           count = len(selected)
           utils.framesToVideoViaCount(srcfilename,outputVid,start,count,25)

    ERROR log
    COMMAND : [’ffmpeg’, ’-r 25’, ’-start_number 1’, ’-i "C :\Users\lalat\Desktop\03008427633\output_%04d.png"’, ’-vframes 382’, ’-vcodec mpeg4’, ’20190810.mp4’]
    DOC CMD : ffmpeg -r 25 -start_number 1 -i "C :\Users\lalat\Desktop\03008427633\output_%04d.png" -vframes 382 -vcodec mpeg4 20190810.mp4
    error b"ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers\r\n built with gcc 8.2.1 (GCC) 20181017\r\n configuration : —enable-gpl —enable-version3 —enable-sdl2 —enable-fontconfig —enable-gnutls —enable-iconv —enable-libass —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\r\n libavutil 56. 22.100 / 56. 22.100\r\n libavcodec 58. 35.100 / 58. 35.100\r\n libavformat 58. 20.100 / 58. 20.100\r\n libavdevice 58. 5.100 / 58. 5.100\r\n libavfilter 7. 40.101 / 7. 40.101\r\n libswscale 5. 3.100 / 5. 3.100\r\n libswresample 3. 3.100 / 3. 3.100\r\n libpostproc 55. 3.100 / 55. 3.100\r\nUnrecognized option ’r 25’.\r\nError splitting the argument list : Option not found\r\n"

  • Encoding a growing video file in realtime fails prematurely

    17 janvier 2023, par Macster

    This batch script is repeatedly concatenating video clips from an textfile. The output file is then beeing encoded in realtime into dash format. Unfortunately the realtime encoding will always end prematurely and I can't figure out why. From what I observed, it shouldn't be possible that the realtime encoding would catch up to the concating - which is happening each time after the duration of the clip that was just added - because I'm setting an offset, to when the encoding has to start, via timeout.

    


    I've tried other formats like .mp4 and .h264 and other options, but nothing seems to help. So my assumption is, that there is a conflict when read/write operation is made and these operations overlap at a certain point. But how do I find out when and how to avoid it ? I haven't had the feeling that something was happening at the exact same time, when observing the command promt.

    


    Command prompt
The screenshot was taken right at failing. As you can see, the concat file queue1.webm is already more than 10 seconds longer than the realtime encoding at its failing position. That's why I don't think it has to do with catching up too fast. It will fail randomly, so one time it fails at 25 seconds and next time it might fail at 2 minutes and 20 seconds.

    


    To avoid the possibility of different video settings causing troubble, I'm using only one video file. I will link it here : BigBuckBunny (Mega NZ) It's a 10 sec snippet from BigBuckBunny. I hope this is legal !? But you can use what ever clip you want.

    


    IMPORTANT : If you try to reproduce the behaviour, please make sure you make at least one entry,
    like file 'bigbuckbunny_webm.webm' in mylist.txt, because adding something if the file is empty is kinda broken :)

    


    So here is the code :

    


    Just the FFMPEG commands :

    


    ffmpeg -f concat -i "mylist.txt" -safe 0  -c copy -f webm -reset_timestamps 1 -streaming 1 -live 1 -y queue1.webm
[..]
ffmpeg -re -i queue1.webm -c copy -map 0:v -use_timeline 1 -use_template 1 -remove_at_exit 0 -window_size 10 -adaptation_sets "id=0,streams=v" -streaming 1 -live 1 -f dash -y queue.mpd


    


    makedir.bat

    


    @ECHO on

:: Create new queue
IF NOT EXIST "queue1.webm" mkfifo "queue1.webm"

setlocal EnableDelayedExpansion

set string=file 'bigbuckbunny_webm.webm'
set video_path=""
SET /a c=0
set file=-1
set file_before=""

:loop
::Get last entry from "mylist.txt"
for /f "delims=" %%a in ('type mylist.txt ^| findstr /b /c:"file"') do (
  set video_path=%%a
)
echo %video_path%

::Insert file 'bigbuckbunny_webm.webm' if mylist.txt is empty.
if "%video_path%" EQU """" (echo %string% >> mylist.txt && set file=%string:~6,-1%) else (set file=%video_path:~6,-1%)

::Insert file 'bigbuckbunny_webm.webm' into mylit.txt if actual entry(%file%) is the same than before(file 'bigbuckbunny_webm.webm').
if "%file%" EQU "%file_before%" (echo. >> mylist.txt && echo %string%>>mylist.txt) 

echo %file%

::Get the video duration
for /f "tokens=1* delims=:" %%a in ('ffmpeg -i %file% 2^>^&1 ^| findstr "Duration"') do (set duration=%%b)
echo %duration%

::Crop format to HH:MM:SS
set duration=%duration:~1,11%
echo %duration%

::Check if seconds are double digits, less than 10, like 09. Then use only 9.
if %duration:~6,1% EQU 0 (
  set /a sec=%duration:~7,1% 
    ) else ( 
        set /a sec=%duration:~6,2%

)
echo %sec%

::Convert duration into seconds
set /a duration=%duration:~0,2%*3600+%duration:~3,2%*60+%sec%
echo %duration%

::echo %duration%

::Increase iteration count.
set /a c=c+1

::Add new clip to queue.
ffmpeg -f concat -i "mylist.txt" -safe 0  -c copy -f webm -reset_timestamps 1 -streaming 1 -live 1 -y queue1.webm

::Start realtime encoding queue1, if a first clip was added.
if !c! EQU 1 (
  start cmd /k "startRealtimeEncoding.bat"
)

::Wait the duration of the inserted video 
timeout /t %duration%

::Set the actual filename as the previous file for the next iteration.
set file_before=%file%

::Stop after c loops.
if !c! NEQ 20 goto loop

echo %c%

endlocal

:end  


    


    startRealtimeEncoding.bat

    


    @ECHO off

timeout /t 5
ffmpeg -re -i queue1.webm -c copy -map 0:v -seg_duration 2 -keyint_min 48 -use_timeline 1 -use_template 1 -remove_at_exit 0 -window_size 10 -adaptation_sets "id=0,streams=v" -streaming 1 -live 1 -f dash -y queue.mpd

:end


    


  • Creating video from list of images using ffmpeg

    13 août 2019, par haseeb

    Summary

    From given code, second function taking UI values and passing to first one. from log, first two lines shows command list and command string.

    What’s irritating me is, if I copied second line from log (dos cmd) and paste it in a cmd prompt, it works successfully and produces video correctly. but running it via gui subprocess, errors out.

    Task Description

    Directory contains thousand of images each after few minutes of a construction project. I need to create a video from data (images) per day basis. I have successfully extracted list of images, etc, and have data.

    utils.py :

    def framesToVideoViaCount(srcFile,outputFile,start,count,rate):
       # ffmpeg -start_number 1 -i test_%04d.png -vframes 100 -vcodec mpeg4 test.mp4
       # "C:\\Users\\lalat\\Desktop\\03008427633\\output_%04d.png"
       # ffmpeg -start_number 50 -i "C:\\Users\\lalat\\Desktop\\03008427633\\output_%04d.png" -vframes 200 -vcodec mpeg4 "C:\\Users\\lalat\\Desktop\\day1.mp4"
       command = [ 'ffmpeg',
                   # '-loglevel', 'fatal',
                   '-r %d' %(rate),
                   '-start_number %d' %(start) ,
                   '-i "%s"' %(srcFile),
                   '-vframes %d' %(count),
                   '-vcodec mpeg4' ]
       # command.append ('fps=%d' % (fps))
       command.append (outputFile)
       print ("COMMAND: " , command)
       print ("DOS CMD: ", ' '.join(command))
       ffmpeg = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
       out, err = ffmpeg.communicate()
       if(err) : print('error',err); return None;
       print (out)

    Actual GUI function call in tk gui app :

    def approachByCount(self):
       tdate = datetime(year=int(self.fyear.get()), month=int(self.fmonth.get()), day=int(self.fdate.get()))
       # now = datetime.datetime.now()
       outputName = str(tdate.strftime("%Y%m%d")) + ".txt"
       outputVid = str(tdate.strftime("%Y%m%d")) + ".mp4"
       files = os.listdir(self.userDir)
       selected = []
       for afile in files:
           afile = os.path.join(self.userDir,afile)
           sdate = datetime.fromtimestamp(os.path.getmtime(afile))
           if sdate.date() == tdate.date():
               selected.append(afile)
       # get first file name
       srcfilename = os.path.basename(selected[0])
       srcfilename,ext = srcfilename.split(".")
       filename,pad = srcfilename.split("_")
       srcfilename = os.path.join(self.userDir,filename+"_%0"+str(len(pad))+"d."+ext)
       start = int(pad)
       count = len(selected)
       utils.framesToVideoViaCount(srcfilename,outputVid,start,count,25)

    ERROR log

    COMMAND:  ['ffmpeg', '-r 25', '-start_number 1', '-i "C:\\Users\\lalat\\Desktop\\03008427633\\output_%04d.png"', '-vframes 382', '-vcodec mpeg4', '20190810.mp4']
    DOC CMD:  ffmpeg -r 25 -start_number 1 -i "C:\Users\lalat\Desktop\03008427633\output_%04d.png" -vframes 382 -vcodec mpeg4 20190810.mp4

    error b"ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers\r\n
    built with gcc 8.2.1 (GCC) 20181017\r\n
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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\r\n
    libavutil      56. 22.100 / 56. 22.100\r\n
    libavcodec     58. 35.100 / 58. 35.100\r\n
    libavformat    58. 20.100 / 58. 20.100\r\n
    libavdevice    58.  5.100 / 58.  5.100\r\n
    libavfilter     7. 40.101 /  7. 40.101\r\n
    libswscale      5.  3.100 /  5.  3.100\r\n
    libswresample   3.  3.100 /  3.  3.100\r\n
    libpostproc    55.  3.100 / 55.  3.100\r\n
    Unrecognized option 'r 25'.\r\n
    Error splitting the argument list: Option not found\r\n"