
Recherche avancée
Autres articles (39)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (6254)
-
Speeding up videocomposing in pymovie
10 février 2024, par rawlungI'm trying to resize videos similarly to what this api provides
https://creatomate.com/docs/json/quick-start/blur-video-background
I accomplished the result more or less but the problem is it takes ages to render out.
I'm a total beginner when it comes to video processing and for the life of me i can't figure out how to speed it up. When the rendering is running python only uses CPU at about 20% utilization.


from moviepy.editor import VideoFileClip, concatenate_videoclips,CompositeVideoClipimport datetimefrom skimage.filters import gaussian

def _blur(image):
 return gaussian(image.astype(float), sigma=25,preserve_range=True,channel_axis=-1)

def blurVideos(filenames):
 clips = [VideoFileClip(c) for c in filenames]
 overlay_clips = [VideoFileClip((c), has_mask=True) for c in filenames]
 overlay = concatenate_videoclips(overlay_clips,"chain")
 output = concatenate_videoclips(clips, method="chain")
 print("Bluring video")
 blured_output = output.fl_image( _blur )
 print("Done")
 print("Resizing video")
 resized_output = blured_output.resize((1920,1080))
 print("Done")
 composited_output = CompositeVideoClip([resized_output.without_audio(),overlay.set_position("center","center")])
 composited_output.write_videofile(f"output/out_{datetime.datetime.today().strftime('%Y-%m-%d')}.mp4",fps=20,threads=16,codec="h264_nvenc",preset="fast")



I've tried to use GPU accelerated codecs like h264_nvenc, I've tried to modify ffmpeg arguments under the hood of moviepy to use cuda also no succses
What can i do to speed this up ?


-
Calling ffmpeg from command line does not wait until file was fully written do hard drive
10 octobre 2020, par Stefan FalkI am currently working on a service to allower conversion of audio files. I am using
ffmpeg
under the hood and use theRuntime
in order to make the call.

After the call I read the converted file and upload it to a cloud storage.


The problem :


The problem is, that reading the file back from the drive gives me only a few bytes. After investigating, it actually has like 5 MB on the drive but
readFileToByArray()
reads only a few kb. I assume this is because the file was not completely persisted at the point where I want to read it back.

Is there any way I can make sure that
ffmpeg
is done writing to the hard drive ? It seems that the main process thatffmpeg
was running in finishes before a parallel process that is responsible for writing. Maybe ?

Below is the relevant code that converts an arbitrary file to AAC-format :


File tempFile = File.createTempFile("input-", ".tmp", new File("/tmp"));
OutputStream outStream = new FileOutputStream(tempFile);
outStream.write(bytes);

String convertedFilePath = String.format("/tmp/output-%s.aac", UUID.randomUUID().toString());

String command = String.format(
 "ffmpeg -i %s -c:a aac -b:a 256k %s",
 tempFile.getAbsolutePath(),
 convertedFilePath
);

LOGGER.debug(String.format("Converting file to AAC; Running %s", command));

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
try {
 process.waitFor(200, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
 throw new RuntimeException("Time out");
}

File convertedFile = new File(convertedFilePath);
byte[] result = FileUtils.readFileToByteArray(convertedFile);

// Upload "result" to cloud storage ..



-
FFmpeg/OpenCV force ignore input frame duration with rtsp ?
6 août 2019, par ZisIsNotZisI was experiencing a
~5 sec
delay when playing a rtsp stream from an IP camera. After a bunch of googling (especially this question), I reduced the delay to~1 sec
using the following command :ffplay -fflags nobuffer -flags low_delay -framedrop -strict experimental \
-probesize 32 -sync ext rtsp://xxx.xxx.xxx.xxxBut when I tried
mplayer -benchmark
command from the same question, I found the delay immediately goes away (i.e. almost 0 delay).In the man page of
mplayer
, it sais :-benchmark
Prints some statistics on CPU usage and dropped frames at the end of playback. Use in combination with -nosound and -vo null for benchmarking only the video codec.
NOTE : With this option MPlayer will also ignore frame duration when playing only video (you can think of that as infinite fps).
I feel this "ignore frame duration" is the key to the question, but after a bunch of googling, I didn’t find any flag related to this in
ffmpeg
. I’m wondering how to force ignore input frame duration inffmpeg
?On the other hand, the reason I’m using
ffmpeg
is because I need to do image processing usingopencv
, while I found it seems to be using some part offfmpeg
under-the-hood when doingcv.VideoCapture('rtsp://xxx.xxx.xxx.xxx')
A solution that directly solves the problem in
opencv
would be even more appreciated. I did try reading theVideoCapture
repeatedly in a separate thread, that didn’t help.
Some info about the RTSP stream : h264, 1920x1080, 15fps, 1 key frame per 4s
Some other solutions I tried :
ffmpeg -r 99999 -i ...
# didn't work
mplayer ... -dumpstream
# it core dumped