
Recherche avancée
Autres articles (103)
-
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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
Sur d’autres sites (12753)
-
Where is moviepy getting the video fps from ?
7 février 2017, par GloinI am using the Python 3 moviepy module for video editing, and I have a few videos that are taken in slow motion. When imported into moviepy, they are massively sped up, and then sit on the last frame for the rest of their duration. Note that, the videos are supposed to be normal for the first couple and last couple of seconds, then slow in the middle.
Unfortunately, I cannot provide the actual video for you to test with, but here is the relevant metadata (fetched with the command
ffprobe -v quiet -print_format json -show_format -show_streams slo-mo_movie.mov
)"r_frame_rate": "240/1",
"avg_frame_rate": "1679400/39481",
"time_base": "1/2400",For comparison, here is the equivalent metadata from a video taken, I think, from the same phone, but without slo-mo :
"r_frame_rate": "30/1",
"avg_frame_rate": "143160/4771",
"time_base": "1/600",I can import the videos in to moviepy with
clip = VideoFileClip("path/to/file.mp4")
, and then for each runprint(clip.fps)
. The first video prints2400
(not a typo from me !), and the second30
.Here is the moviepy code (in
moviepy/video/io/ffmpeg_reader.py
) at line 293) that gets the fps :# Get the frame rate. Sometimes it's 'tbr', sometimes 'fps', sometimes
# tbc, and sometimes tbc/2...
# Current policy: Trust tbr first, then fps. If result is near from x*1000/1001
# where x is 23,24,25,50, replace by x*1000/1001 (very common case for the fps).
try:
match = re.search("( [0-9]*.| )[0-9]* tbr", line)
tbr = float(line[match.start():match.end()].split(' ')[1])
result['video_fps'] = tbr
except:
match = re.search("( [0-9]*.| )[0-9]* fps", line)
result['video_fps'] = float(line[match.start():match.end()].split(' ')[1])
# It is known that a fps of 24 is often written as 24000/1001
# but then ffmpeg nicely rounds it to 23.98, which we hate.
coef = 1000.0/1001.0
fps = result['video_fps']
for x in [23,24,25,30,50]:
if (fps!=x) and abs(fps - x*coef) < .01:
result['video_fps'] = x*coef
if check_duration:
result['video_nframes'] = int(result['duration']*result['video_fps'])+1
result['video_duration'] = result['duration']
else:
result['video_nframes'] = 1
result['video_duration'] = None
# We could have also recomputed the duration from the number
# of frames, as follows:
# >>> result['video_duration'] = result['video_nframes'] / result['video_fps']If I set the slo-mo video’s fps using moviepy to 24, it outputs it the same (very fast, then still on the last frame), but if I set the slo-mo video’s fps to 20, then it outputs it correctly.
Obviously video players like VLC player and Quicktime can correctly work out what frame speed to play, but moviepy/ffmpeg fails. Moviepy/ffmpeg is getting the wrong fps from somewhere.
So, how can I get moviepy to automatically output them as they are supposed to be without human trial and error like above ?
-
FFMPEG Keyframes Exception
3 avril 2017, par newToRacketI was hoping someone could help me, when pulling keyframes from a .mp4 file using FFMPEG in python I get this error :
C:\Python27\python.exe "C:/Coll. Detection/UAS_Detection/GUI.py"
in GUI main
('filePath', PyQt4.QtCore.QString(u'C:\\Users\\Razor\\Downloads\\video_test_512kb.mp4'), '\n')
File Path -> C:\Users\Razor\Downloads\video_test_512kb.mp4
SingleDetect C:\Users\Razor\Downloads\video_test_512kb.mp4
ffmpeg version N-84679-gd65b595 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 51.100 / 55. 51.100
libavcodec 57. 86.103 / 57. 86.103
libavformat 57. 67.100 / 57. 67.100
libavdevice 57. 3.101 / 57. 3.101
libavfilter 6. 78.100 / 6. 78.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Razor\Downloads\video_test_512kb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
creation_time : 1970-01-01T00:00:00.000000Z
title : test file mp4 - http://www.archive.org/details/Pbtestfilemp4videotestmp4
encoder : Lavf51.10.0
comment : license: http://creativecommons.org/licenses/by-nc-sa/2.5/
Duration: 00:00:16.27, start: 0.000000, bitrate: 562 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 512 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 45 kb/s (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0000000003500e00] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'tmp/%d.jpeg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: mp41
comment : license: http://creativecommons.org/licenses/by-nc-sa/2.5/
title : test file mp4 - http://www.archive.org/details/Pbtestfilemp4videotestmp4
encoder : Lavf57.67.100
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc (default)
Metadata:
creation_time : 1970-01-01T00:00:00.000000Z
handler_name : VideoHandler
encoder : Lavc57.86.103 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
2017-04-02 18:36:07.832000
Traceback (most recent call last):
File "Detection.py", line 59, in <module>
draw_detections(frame, found)
File "Detection.py", line 32, in draw_detections
result = Result.objects.create(picture=img, x=x, y=y, w=w, h=h)
AttributeError: type object 'Result' has no attribute 'objects'
frame= 21 fps=0.0 q=19.3 Lsize=N/A time=00:00:16.06 bitrate=N/A speed= 191x
video:160kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Process finished with exit code 0
</module>I’m trying to run these keyframes through an opencv human shape recognition api. It saves close to 300 keyframes to the folder I specified but for some reason the program just hangs afterwords instead of running the open cv hogger api on the newly saved keyframes. Will post script if it will help. Thank you for any help you can provide !!!
-
swscale : use dithering in DITHER_COPY only if not set -sws_dither none
24 octobre 2017, par Mateuszswscale : use dithering in DITHER_COPY only if not set -sws_dither none
This patch uses dithering in DITHER_COPY macro only if
it was not used option '-sws_dither none'.
With option '-sws_dither none' it uses downshift.For human eye dithering is OK, for video codecs not necessarily.
If user don't want to use dithering, we should respect that.Signed-off-by : Mateusz Brzostek <mateuszb@poczta.onet.pl>
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>