
Recherche avancée
Autres articles (5)
-
Que fait exactement ce script ?
18 janvier 2011, parCe script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
Installation de dépendances de MediaSPIP
Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (2976)
-
Trimming videos with 'ffmpeg and ffprobe'
10 août 2022, par adeshina IbrahimI am working on an ETL process, and I'm now in the final stage of preprocessing my videos. I used the script below (reference : @FarisHijazi) to first auto detected black-screen frames using ffprobe and trim them out using ffmpeg.


The script worked for me but the problems are :


- 

-
It cut off all other good frames together with the first bad frames. e.g. if gBgBgBgB represents a sequence of good and BAD frames for 5sec each, the script only returned the first g(5sec) and cut off the other BgBgBgB after it. I want to have only g g g g where all B B B B has been removed


-
I also want to detect other colors aside black-screen e.g. green-screen or red-screen or blurry part of video


-
Script doesn't work if video has no audio in it.










import argparse
import os
import shlex
import subprocess

parser = argparse.ArgumentParser(
 __doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("input", type=str, help="input video file")
parser.add_argument(
 "--invert",
 action="store_true",
 help="remove nonblack instead of removing black",
)
args = parser.parse_args()

##FIXME: sadly you must chdir so that the ffprobe command will work
os.chdir(os.path.split(args.input)[0])
args.input = os.path.split(args.input)[1]

spl = args.input.split(".")
outpath = (
 ".".join(spl[:-1])
 + "."
 + ("invert" if args.invert else "")
 + "out."
 + spl[-1]
)


def delete_back2back(l):
 from itertools import groupby

 return [x[0] for x in groupby(l)]


def construct_ffmpeg_trim_cmd(timepairs, inpath, outpath):
 cmd = f'ffmpeg -i "{inpath}" -y -r 20 -filter_complex '
 cmd += '"'
 for i, (start, end) in enumerate(timepairs):
 cmd += (
 f"[0:v]trim=start={start}:end={end},setpts=PTS-STARTPTS,format=yuv420p[{i}v]; "
 + f"[0:a]atrim=start={start}:end={end},asetpts=PTS-STARTPTS[{i}a]; "
 )
 for i, (start, end) in enumerate(timepairs):
 cmd += f"[{i}v][{i}a]"
 cmd += f"concat=n={len(timepairs)}:v=1:a=1[outv][outa]"
 cmd += '"'
 cmd += f' -map [outv] -map [outa] "{outpath}"'
 return cmd


def get_blackdetect(inpath, invert=False):
 ffprobe_cmd = f'ffprobe -f lavfi -i "movie={inpath},blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1 -v quiet'
 print("ffprobe_cmd:", ffprobe_cmd)
 lines = (
 subprocess.check_output(shlex.split(ffprobe_cmd))
 .decode("utf-8")
 .split("\n")
 )
 times = [
 float(x.split("=")[1].strip()) for x in delete_back2back(lines) if x
 ]
 assert len(times), "no black scene detected"

 if not invert:
 times = [0] + times[:-1]
 timepairs = [
 (times[i], times[i + 1]) for i in range(0, len(times) // 2, 2)
 ]
 return timepairs


if __name__ == "__main__":
 timepairs = get_blackdetect(args.input, invert=args.invert)
 cmd = construct_ffmpeg_trim_cmd(timepairs, args.input, outpath)

 print(cmd)
 os.system(cmd)



-
-
ffmpeg pipe blocks while capturing
26 juin 2013, par Marco VasapolloI have this code :
public InputStream getInputStream() throws Exception {
try {
process = Runtime.getRuntime().exec("ffmpeg -f dshow -i video=\"" + query + "\":audio=\"" + microPhoneName + "\" -r 25 -vcodec mpeg4 -acodec mp3 -f avi -");
}
catch (Exception e) {
}
return process.getInputStream();
}When i use the
inputStream.read(b)
command, it works only for a little bit of times (180 to 400 times, depending from formats and codecs I use) then theinputStream
lock onread
and the application doesn't go anymore.What's the problem ? Memory saturation (ffmpeg process memory is at least 14mb) ?
Is there a way to unlock this situation (clean memory, use a file as a bridge to prevent locks) ?Of course I need a little bit of "realtime", and not "post-process".
I'm not constrained to use ffmpeg, I can change it if necessary. -
aarch64 : NEON asm for integral init
14 août 2014, par Janne Grunau