Recherche avancée

Médias (1)

Mot : - Tags -/livre électronique

Autres articles (29)

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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (3716)

  • 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 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"

  • youtube-dl, is there a way to extract the "specific format" video URL ? [closed]

    29 juillet 2020, par karma

    Following my question before in this link,
    
It seems that the copied version is from the highest resolution format, as the resulting video portion is 1920x1080 resolution.

    


    The available format :

    


    C:\Standalone Program\YoutubeDL>youtube-dl -F https://www.youtube.com/watch?v=kGDgGsrA78s
[youtube] kGDgGsrA78s: Downloading webpage
[info] Available formats for kGDgGsrA78s:
format code  extension  resolution note
249          webm       audio only tiny   52k , opus @ 50k (48000Hz), 7.49MiB
250          webm       audio only tiny   65k , opus @ 70k (48000Hz), 9.45MiB
251          webm       audio only tiny  114k , opus @160k (48000Hz), 17.07MiB
140          m4a        audio only tiny  164k , m4a_dash container, mp4a.40.2@128k (44100Hz), 21.06MiB
278          webm       256x144    144p  103k , webm container, vp9, 30fps, video only, 15.78MiB
160          mp4        256x144    144p  117k , avc1.4d400c, 30fps, video only, 12.96MiB
242          webm       426x240    240p  231k , vp9, 30fps, video only, 33.40MiB
133          mp4        426x240    240p  254k , avc1.4d4015, 30fps, video only, 25.10MiB
243          webm       640x360    360p  420k , vp9, 30fps, video only, 60.81MiB
134          mp4        640x360    360p  652k , avc1.4d401e, 30fps, video only, 61.92MiB
244          webm       854x480    480p  781k , vp9, 30fps, video only, 105.14MiB
135          mp4        854x480    480p 1190k , avc1.4d401f, 30fps, video only, 114.76MiB
247          webm       1280x720   720p 1550k , vp9, 30fps, video only, 211.07MiB
136          mp4        1280x720   720p 2383k , avc1.4d401f, 30fps, video only, 213.18MiB
248          webm       1920x1080  1080p 2752k , vp9, 30fps, video only, 408.32MiB
137          mp4        1920x1080  1080p 4443k , avc1.640028, 30fps, video only, 435.80MiB
18           mp4        640x360    360p  640k , avc1.42001E, 30fps, mp4a.40.2@ 96k (44100Hz), 106.07MiB (best)


    


    So after I do :

    


    youtube-dl -g https://www.youtube.com/watch?v=kGDgGsrA78s


    


    and the video URL result :

    


    https://r2---sn-uigxxi0ujipnvo-q2ne.googlevideo.com/videoplayback?expire=1596034295&ei=lzghX6SHKMOD8QPlx5SQBw&ip=223.255.228.87&id=o-AK6cYo88zJXe5Xb4y1QsXspuRnVCy-zPFpMaHcAaTQ-_&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=DA&mm=31%2C29&mn=sn-uigxxi0ujipnvo-q2ne%2Csn-npoe7nlz&ms=au%2Crdu&mv=m&mvi=2&pl=24&initcwndbps=173750&vprv=1&mime=video%2Fmp4&gir=yes&clen=456970484&dur=1389.955&lmt=1521825834085900&mt=1596012582&fvip=5&keepalive=yes&fexp=23883098&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAMvZrHYvC1YrkvtARzhjyD8dnMnlefobGrOFM1rX6QZPAiEAqqeIsKdZ19y-SlHf-l8YwTx2yYbo1p5sFlVoC87oXEQ%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgAIwAVMPrcMhAL476uN_ZzWj8vKPGGW58KCpHBYBsKeICICRgVWgthNvgbGl8VgQwscjJ0n8ib4XBNjRxRgSg2T5r&ratebypass=yes


    


    I think the URL is for :

    


    137          mp4        1920x1080  1080p 4443k , avc1.640028, 30fps, video only, 435.80MiB


    


    Since I want a smaller file size, I wonder if it's possible to get the video URL (for example) for :

    


    243          webm       640x360    360p  420k , vp9, 30fps, video only, 60.81MiB


    


    So then later when I feed the URL to ffmpeg to extract some portion of that lower quality video URL, the result has a smaller file size.

    


    Any kind of help would be greatly appreciated.
Thank you in advanced.

    


    BTW, I use Windows 10 command prompt (administrator).