
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (92)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)
Sur d’autres sites (3069)
-
Creating video from list of images using ffmpeg
13 août 2019, par haseebSummary
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" -
Encoding a growing video file in realtime fails prematurely
17 janvier 2023, par MacsterThis 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.



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,
likefile 'bigbuckbunny_webm.webm'
inmylist.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 haseebsummary
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 datadef 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"