
Recherche avancée
Médias (1)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (99)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 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 (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (15715)
-
Calling python script using a php script accessed by the browser
16 novembre 2014, par lfalmeidaI have a php script which will receives uploaded videos and I would like to convert these videos using ffmpeg.
I created a python script that receives parameters from php and calls ffmpeg to do the conversion.
index.php
<?php
$data = array('filePath' => 'video.mov');
$result = shell_exec('/usr/bin/python /home/fernando/Workspace/lab1/public_html/converter.py ' . escapeshellarg(json_encode($data)));converter.py
#!/usr/bin/env python
import os, sys, json, subprocess, string, random
class Converter():
WORK_DIR = '/home/fernando/Workspace/lab1/public_html'
DESTINATION_DIR = '/home/fernando/Workspace/lab1/public_html/videos/'
NEW_AUDIO = 'audio.mp3'
def __init__(self, data):
try:
os.chdir(self.WORK_DIR)
self.arg = data
except:
print "ERROR"
sys.exit(1)
def generateId():
return ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase ) for _ in range(12))
def convertVideo(self, type):
convertedFileName = self.DESTINATION_DIR + self.generateId() + '.' + type
typesDic = {
'mp4': ['/usr/bin/ffmpeg', '-loglevel', 'quiet', '-i', self.arg['filePath'], '-i', self.NEW_AUDIO, '-map', '0:0', '-map', '1', '-shortest', '-codec', 'copy', convertedFileName, '-y'],
'ogv': ['/usr/bin/ffmpeg', '-loglevel', 'quiet', '-i', self.arg['filePath'], '-i', self.NEW_AUDIO, '-map', '0:0', '-map', '1', '-shortest', '-vcodec', 'libtheora', '-acodec', 'libvorbis', convertedFileName, '-y']
}
sp = subprocess.Popen(typesDic[type], shell=True)
out, err = sp.communicate()
if err:
return {'status': 'error'}
return {'status': 'success', 'filename': convertedFileName}
data = json.loads(sys.argv[1])
c = Converter(data)
print c.convertVideo('mp4')
print c.convertVideo('ogv')These codes are working the way I need, but only if I call them
via the command line.
Ex :$ php index.php
ou :$ ./converter.py '{"fileName": "video.avi"}'
If I access via browser, which was my main intention, does not work.
I wonder what is wrong ?
You can do this via browser ?
Would have a better approach ?edited :
Output from apache error logUse -h to get full help or, even better, run 'man ffmpeg'
ffmpeg version 1.2.6-7:1.2.6-1 trusty1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration : —arch=amd64 —disable-stripping —enable-avresample —enable-pthreads —enable-runtime-cpudetect —extra-version=’7:1.2.6-1 trusty1’ —libdir=/usr/lib/x86_64-linux-gnu —prefix=/usr —enable-bzlib —enable-libdc1394 —enable-libfreetype —enable-frei0r —enable-gnutls —enable-libgsm —enable-libmp3lame —enable-librtmp —enable-libopencv —enable-libopenjpeg —enable-libopus —enable-libpulse —enable-libschroedinger —enable-libspeex —enable-libtheora —enable-vaapi —enable-vdpau —enable-libvorbis —enable-libvpx —enable-zlib —enable-gpl —enable-postproc —enable-libcdio —enable-x11grab —enable-libx264 —shlibdir=/usr/lib/x86_64-linux-gnu —enable-shared —disable-static
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 53. 5.103 / 53. 5.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Hyper fast Audio and Video encoder
usage : ffmpeg [options] [[infile options] -i infile]... [outfile options] outfile...Use -h to get full help or, even better, run ’man ffmpeg’
ffmpeg version 1.2.6-7:1.2.6-1 trusty1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration : —arch=amd64 —disable-stripping —enable-avresample —enable-pthreads —enable-runtime-cpudetect —extra-version=’7:1.2.6-1 trusty1’ —libdir=/usr/lib/x86_64-linux-gnu —prefix=/usr —enable-bzlib —enable-libdc1394 —enable-libfreetype —enable-frei0r —enable-gnutls —enable-libgsm —enable-libmp3lame —enable-librtmp —enable-libopencv —enable-libopenjpeg —enable-libopus —enable-libpulse —enable-libschroedinger —enable-libspeex —enable-libtheora —enable-vaapi —enable-vdpau —enable-libvorbis —enable-libvpx —enable-zlib —enable-gpl —enable-postproc —enable-libcdio —enable-x11grab —enable-libx264 —shlibdir=/usr/lib/x86_64-linux-gnu —enable-shared —disable-static
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 53. 5.103 / 53. 5.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Hyper fast Audio and Video encoder
usage : ffmpeg [options] [[infile options] -i infile]... [outfile options] outfile...Use -h to get full help or, even better, run ’man ffmpeg’
-
Can't break out of innermost while loop — Bash - Ubuntu
16 novembre 2014, par Kenny PowersWhenever the two MD5 check sums ($SUMCHK1 & $SUMCHK2) match up in this script I get stuck in the innermost while loop, so the script never ends. When the two log files match, I get an endless echo of the two md5sums on the screen.
#!/bin/bash
FULLPATH=$1
FPS=$2
AVI=$(basename $1)
AVIDIR=$HOME/q7video/$AVI
TMPFILE=$AVIDIR/tmp.txt
TMPFILE2=$AVIDIR/tmp2.txt
NEWFILES=$AVIDIR/tmp3.txt
FFLOG=$AVIDIR/ffmpeg.log
LOGFILE=$AVIDIR/log.log
FACESDIR=$AVIDIR/faces
# CREATE FOLDER STRUCTURE, NO ERROR IF DIR PRE-EXISTS
mkdir --parents $AVIDIR
mkdir --parents $FACESDIR
touch $TMPFILE $TMPFILE2 $NEWFILES $LOGFILE
echo $AVI > $LOGFILE
# DUMP THUMBNAILS FROM SPECIFIED AVI FILE
ffmpeg -i $FULLPATH -f image2 -vf fps=fps=$FPS $AVIDIR/$AVI%03d.jpg null >/dev/null 2>$FFLOG &
# DELAY TO ALLOW LOOP A WORKING DIRECTORY BEFORE START
sleep 2
#TOUCH FILES TO PREVENT NO FILE ERROR
touch $TMPFILE $TMPFILE2
# INITIALIZE VARIABLE FOR LOOP
CHECK=`pgrep ffmpeg`
I=0
SUMCHK1=`md5sum $TMPFILE`
SUMCHK2=`md5sum $TMPFILE2`
while [[ "$CHECK" -gt "$I" ]]; do
sleep 2
echo FFMPEG RUNNING
ls $AVIDIR/*.jpg > $TMPFILE
while [[ "$SUMCHK1" != "$SUMCHK2" ]]; do
comm -23 $TMPFILE $TMPFILE2 > $NEWFILES
while read F ; do
echo $F
echo $F >> $TMPFILE2
echo $F >> $LOGFILE
python opencvtest.py $F >> $LOGFILE
done < $NEWFILES
ls $AVIDIR/*.jpg > $TMPFILE
SUMCHK1=`md5sum $TMPFILE`
SUMCHK2=`md5sum $TMPFILE2`
echo $SUMCHK1
echo $SUMCHK2
done
CHECK=`pgrep ffmpeg`
echo $CHECK
done
# COPY IMAGES WITH A FACE TO FACESDIR
# CLEANUP LOGS
#rm $TMPFILE $TMPFILE2 $NEWFILES -
Bash process substitution in Python with Popen
2 juin 2015, par moorejI’m attempting to create a looped video file by calling ffmpeg from the python subprocess library. Here’s the part that’s giving me problems :
import subprocess as sp
sp.Popen(['ffmpeg', '-f', 'concat', '-i', "<(for f in ~/Desktop/*.mp4; do echo \"file \'$f\'\"; done)", "-c", "copy", "~/Desktop/sample3.mp4"])With the above code I’m getting the following error :
<(for f in /home/delta/Desktop/*.mp4; do echo "file '$f'"; done): No such file or directory
I did find a similarly phrased question here. But I’m not sure how the solution might apply to solving my issue.
Edit :
Thanks for the help everyone ! Following the advice in the comments and looking elsewhere I ended up changing the code to this :sp.Popen("ffmpeg -f concat -i <(for f in ~/Desktop/*.mp4; do echo \"file \'$f\'\"; done) -c copy ~/Desktop/sample3.mp4", shell=True, executable="/bin/bash")
—which works fine.