
Recherche avancée
Autres articles (108)
-
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 (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (16037)
-
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)



-
-
Revision a274fd4c9dfeec5796609debedc0dcfa0c254ea6 : gestion des droits d’edition du lien, et desactivation auto des parties ...
7 octobre 2010, par Cerdic — Loggestion des droits d’edition du lien, et desactivation auto des parties editables du formulaire git-svn-id : svn ://trac.rezo.net/spip/spip@16462 caf5f3e8-d4fe-0310-bb3e-c32d5e47d55d
-
Revision b723b37258673b714e25def1974bb92ca588d0f4 : chaines de langue et style pour l’edition des mots lies git-svn-id : ...
24 octobre 2010, par Cerdic — Logchaines de langue et style pour l’edition des mots lies git-svn-id : svn ://trac.rezo.net/spip/spip@16504 caf5f3e8-d4fe-0310-bb3e-c32d5e47d55d