
Recherche avancée
Autres articles (55)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (7982)
-
Revision 115390 : Pour la vérif date, on ne fait plus de dérogation en dur, mais on gère ...
14 mai 2019, par rastapopoulos@… — LogPour la vérif date, on ne fait plus de dérogation en dur, mais on gère le cas où c’est vide dans la fonction dédiée. En effet, même si c’est vide, on veut absolument passer dedans car ça peut être normalisé ! Là si c’était vide, pas de normalisation et donc pétage de SQL si on devait avoir un datetime. Dans tous les cas, la fonction renvoie pareil qu’avant : chaine vide, si la date est vide, mais c’est fait en interne.
-
I am calling ffmpeg from Python. Getting thread.error and repeated attempts to connect to audio stream
16 février 2016, par user2192778I have some code which calls ffmpeg at a particular time of the day to record a web stream. First, the function that calls ffmpeg...
def record_stream():
ffmpegEXE = "C:/pathtoffmpeg/ffmpeg.exe"
subprocess.call([ffmpegEXE, '-i', http://streamurl.mp3, output.mp3], shell=True)Then, the function which schedules
record_stream
according to the clock...def sched ():
i = 0
while True:
x = datetime.today()
y=x.replace(day=x.day+1, hour=i, minute= start_minute, second=0, microsecond=0)
delta_t=y-x
secs=delta_t.seconds+1
t = Timer(secs,stream_record)
t.start()
i = (i + 1) % 24When I launch the .py program an error reads :
Traceback <most recent="recent" call="call" last="last">
... line X, in <module>
sched ()
... line Y, in sched ()
t.start()
... line Z, in start
_start_new_thread(self.__bootstrap,())
thread.error: can't start new thread
</module></most>Despite the error, the program runs.
When it runs, however, ffmpeg initializes over and over again. It connects to the stream, then connects to the stream again (this time saying "output.mp3 already exists. Overwrite ? Y/N" It will do this ten or so times until it finally just records the stream in a normal way.
How do I fix these errors ? How do I stop this issue with ffmpeg connecting repeatedly ?
-
AWS Lambda subprocess OSError : [Errno 2] No such file or directory
11 septembre 2016, par LevI’m trying to create a lambda function that makes collection of thumbnails from a video on amazon s3 using ffmpeg. ffmpeg binary is included into fuction package.
function code :
# -*- coding: utf-8 -*-
import stat
import shutil
import boto3
import logging
import subprocess as sp
import os
import threading
thumbnail_prefix = 'thumb_'
thumbnail_ext = '.jpg'
time_delta = 1
video_frames_path = 'media/videos/frames'
print('Loading function')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
lambda_tmp_dir = '/tmp' # Lambda fuction can use this directory.
# ffmpeg is stored with this script.
# When executing ffmpeg, execute permission is requierd.
# But Lambda source directory do not have permission to change it.
# So move ffmpeg binary to `/tmp` and add permission.
ffmpeg_bin = "{0}/ffmpeg.linux64".format(lambda_tmp_dir)
shutil.copyfile('/var/task/ffmpeg.linux64', ffmpeg_bin)
os.chmod(ffmpeg_bin, 777)
# tried also:
# os.chmod(ffmpeg_bin, os.stat(ffmpeg_bin).st_mode | stat.S_IEXEC)
s3 = boto3.client('s3')
def get_thumb_filename(num):
return '{prefix}{num:03d}{ext}'.format(prefix=thumbnail_prefix, num=num, ext=thumbnail_ext)
def create_thumbnails(video_url):
i = 1
filenames_list = []
filename = None
while i == 1 or os.path.isfile(os.path.join(os.getcwd(), get_thumb_filename(i-1))):
if filename:
filenames_list.append(filename)
time = time_delta * (i - 1)
filename = get_thumb_filename(i)
print(ffmpeg_bin)
if os.path.isfile(ffmpeg_bin):
print('ok')
sp.call(['sudo',
ffmpeg_bin,
'-ss',
str(time),
'-i',
video_url,
'-frames:v',
'1',
get_thumb_filename(i)])
i += 1
print(filenames_list)
return filenames_list
def s3_upload_file(file_path, key, bucket, acl, content_type):
file = open(file_path, 'r')
s3.put_object(
Bucket=bucket,
ACL=acl,
Body=file,
Key=key,
ContentType=content_type
)
logger.info("file {0} moved to {1}/{2}".format(file_path, bucket, key))
def s3_upload_files_in_threads(filenames_list, dir_path, bucket, s3path, acl, content_type):
for filename in filenames_list:
if os.path.isfile(os.path.join(dir_path, filename)):
print(os.path.join(dir_path, filename))
t = threading.Thread(target=s3_upload_file,
args=(os.path.join(dir_path, filename),
'{0}/{1}'.format(s3path, filename),
bucket,
acl,
content_type)).start()
def lambda_handler(event, context):
bucket = event['Records'][0]['s3']['bucket']['name']
video_key = event['Records'][0]['s3']['object']['key']
video_name = video_key.split('/')[-1].split('.')[0]
video_url = 'http://{0}/{1}'.format(bucket, video_key)
filenames_list = create_thumbnails(video_url)
s3_upload_files_in_threads(filenames_list,
os.getcwd(),
bucket,
'{0}/{1}'.format(video_frames_path, video_name),
'public-read',
'image/jpeg')
returnduring the execution I get following logs :
Loading function
/tmp/ffmpeg.linux64
ok
[Errno 2] No such file or directory: OSError
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 112, in lambda_handler
filenames_list = create_thumbnails(video_url)
File "/var/task/lambda_function.py", line 77, in create_thumbnails
get_thumb_filename(i)])
File "/usr/lib64/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directoryWhen I use the same sp.call() with the same ffmpeg binary on my ec2 instance it works fine.