
Recherche avancée
Autres articles (56)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (8252)
-
ValueError : I/O operation on closed file when making animation
3 juillet 2018, par user3851187I am using matplotlib and ffmpeg to do some animations. I usually code on a remote server because the code runs faster ; we are having some issues making animations on the remote server. Here is an example of code that works perfectly on my local mac but does not work remotely.
import matplotlib as mpl
mpl.use('agg')
import matplotlib as mpl
from matplotlib import animation
import pylab
def init():
pylab.plot(pylab.arange(10), [0]*10)
def redraw(frame):
pylab.plot(pylab.arange(10), pylab.arange(10) * frame)
fig = pylab.figure()
ani = animation.FuncAnimation(fig, redraw, frames=10, interval=1000, init_func=init)
ani.save('animation.mp4')I get the animation I want on my local machine (macOS Sierra). When I run it on the remote host (Debian GNU/Linux 8 (jessie)), I get the following error message after 5 frames
Traceback (most recent call last):
File "animation.py", line 14, in <module>
ani.save('animation.mp4')
File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 1200, in save
writer.grab_frame(**savefig_kwargs)
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 241, in saving
self.finish()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 367, in finish
self.cleanup()
File "/usr/local/lib/python2.7/dist-packages/matplotlib/animation.py", line 405, in cleanup
out, err = self._proc.communicate()
File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 724, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1535, in _communicate
orig_timeout)
File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1591, in _communicate_with_poll
register_and_append(self.stdout, select_POLLIN_POLLPRI)
File "/usr/local/lib/python2.7/dist-packages/subprocess32.py", line 1570, in register_and_append
poller.register(file_obj.fileno(), eventmask)
ValueError: I/O operation on closed file
</module>My local machine uses matplotlib version 2.0.0 ; the remote machine uses matplotlib version 2.2.2
On my local machine I have ffmpeg version 3.2.4
$ ffmpeg -version
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared -
-enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100On the remote host i have ffmpeg version 4.0.1
ffmpeg -version
ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10+deb8u1)
configuration: --prefix=/usr/local
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100If I recall correctly I installed ffmpeg locally through homebrew ; I have the anaconda distribution of python. On the remote machine we have the default version of python that comes with Jessie ; I’m not sure how the sysadmin installed ffmpeg.
I am by no means an expert on ffmpeg, but I have generally never had issues with making animations in matplotlib on my local machine and I would really like to be able to make videos more quickly on the remote machine. Any help would be appreciated !
Edit
On the remote machine, the animation works if I use avconv as the writer instead of ffmpeg. I installed avconv locally...which led me to get the same ffmpeg issues locally (probably due to updating shared dependencies). However, I uninstalled ffmpeg and reinstalled it with x264 codec enables Animations in ipython (jupyter) notebook - ValueError : I/O operation on closed file -
ffmpeg output to opencv
28 juin 2018, par 徐立派I am currently writing a simple script to pipe the output of ffmpeg to opencv, but it keeps yelling me error.
My entire command line is
ffmpeg -flags output_corrupt -analyzeduration 32 -probesize 32 -i temp_file.h264 -updatefirst 1 -y -qscale:v 2 -vf scale="240 :-1" -f image2pipe - | python cap.py
My code for the python script is below
import sys
import cv2 as cv
import numpy as np
while True:
img = sys.stdin
# print img
# img = cv.imdecode(img, 1)
if img is not None:
cv.imshow("Video", img)
cv.waitkey(1)
else:
print "No image"After I execute the command line, I got the following messages :
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[h264 @ 0x557ea6b01a60] Stream #0: not enough frames to estimate rate; consider increasing probesize
[h264 @ 0x557ea6b01a60] decoding for stream 0 failed
Input #0, h264, from 'temp_file.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p(pc, progressive), 1280x720, 29.97 tbr, 1200k tbn, 59.94 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
[h264 @ 0x557ea6b22a60] error while decoding MB 54 2, bytestream -16
[h264 @ 0x557ea6b22a60] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6b22a60] error while decoding MB 2 9, bytestream 6907
[h264 @ 0x557ea6b22a60] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
[h264 @ 0x557ea6b28740] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6b28740] error while decoding MB 27 0, bytestream 5564
[h264 @ 0x557ea6b28740] deblocking filter parameters 7 13 out of range
[h264 @ 0x557ea6b28740] decode_slice_header error
[h264 @ 0x557ea6b28740] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x557ea6ba5be0] deblocking filter parameters 7 -14 out of range
[h264 @ 0x557ea6ba5be0] decode_slice_header error
[swscaler @ 0x557ea7159ba0] deprecated pixel format used, make sure you did set range correctly
[mpeg2video @ 0x557ea6b2ecc0] too many threads/slices (10), reducing to 9
[h264 @ 0x557ea6ba5be0] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
Output #0, mpegts, to 'pipe:':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: mpeg2video (Main), yuv420p, 240x135, q=2-31, 200 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.107.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[h264 @ 0x557ea6bc1b60] deblocking filter parameters -7 0 out of range
[h264 @ 0x557ea6bc1b60] decode_slice_header error
[h264 @ 0x557ea6bc1b60] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
[h264 @ 0x557ea6bddae0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6bddae0] error while decoding MB 9 0, bytestream 6647
[h264 @ 0x557ea6bddae0] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
[h264 @ 0x557ea6bf9a60] top block unavailable for requested intra mode
[h264 @ 0x557ea6bf9a60] error while decoding MB 16 9, bytestream 6182
[h264 @ 0x557ea6bf9a60] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6bf9a60] error while decoding MB 6 18, bytestream 7043
[h264 @ 0x557ea6bf9a60] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x557ea6c159e0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6c159e0] error while decoding MB 12 9, bytestream 6863
[h264 @ 0x557ea6c159e0] concealing 1342 DC, 1342 AC, 1342 MV errors in P frame
[h264 @ 0x557ea6c31d40] top block unavailable for requested intra mode
[h264 @ 0x557ea6c31d40] error while decoding MB 29 18, bytestream 6611
[h264 @ 0x557ea6c31d40] concealing 1405 DC, 1405 AC, 1405 MV errors in P frame
[h264 @ 0x557ea6c4e0a0] top block unavailable for requested intra mode
[h264 @ 0x557ea6c4e0a0] error while decoding MB 25 9, bytestream 6051
[h264 @ 0x557ea6c4e0a0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6c4e0a0] error while decoding MB 70 18, bytestream 5088
[h264 @ 0x557ea6c4e0a0] concealing 1419 DC, 1419 AC, 1419 MV errors in P frame
[h264 @ 0x557ea6c6a400] top block unavailable for requested intra mode
[h264 @ 0x557ea6c6a400] error while decoding MB 14 9, bytestream 6071
[h264 @ 0x557ea6c6a400] deblocking filter parameters -9 0 out of range
[h264 @ 0x557ea6c6a400] decode_slice_header error
[h264 @ 0x557ea6c6a400] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
[h264 @ 0x557ea6c86760] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6c86760] error while decoding MB 54 9, bytestream 4422
[h264 @ 0x557ea6c86760] concealing 1256 DC, 1256 AC, 1256 MV errors in P frame
[h264 @ 0x557ea6ca2ac0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6ca2ac0] error while decoding MB 22 9, bytestream 5862
[h264 @ 0x557ea6ca2ac0] concealing 1335 DC, 1335 AC, 1335 MV errors in P frame
[h264 @ 0x557ea6b2f180] deblocking filter parameters 7 -4 out of range
[h264 @ 0x557ea6b2f180] decode_slice_header error
[h264 @ 0x557ea6b2f180] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
Traceback (most recent call last):
File "cap.py", line 11, in <module>
cv.imshow("Video", img)
TypeError: mat is not a numpy array, neither a scalar
[h264 @ 0x557ea6b22a60] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
[h264 @ 0x557ea6b28740] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6b28740] error while decoding MB 16 9, bytestream 6218
[h264 @ 0x557ea6b28740] concealing 1416 DC, 1416 AC, 1416 MV errors in P frame
[h264 @ 0x557ea6ba5be0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6ba5be0] error while decoding MB 12 0, bytestream 6854
[h264 @ 0x557ea6ba5be0] top block unavailable for requested intra mode -1
[h264 @ 0x557ea6ba5be0] error while decoding MB 2 9, bytestream 7092
</module>It seems that opencv doesn’t recognize the image that I pipe to it with
Traceback (most recent call last):
File "cap.py", line 11, in <module>
cv.imshow("Video", img)
TypeError: mat is not a numpy array, neither a scalar
</module>Anyone know where the problem is ? Any help is appreciated, thanks in advance.
-
ffmpeg command with action subprocess
1er juillet 2018, par MathJunkieyI want to run this command in a python script
cmd = 'ffmpeg -ss ' + start_time + ' -i remove_takeoff.mp4 -filter_complex "[0]trim=0,setpts=PTS-STARTPTS[b];[b][0]overlay=shortest=1" -shortest -c:a trimmed_takeoff.mp4'
I’m using the following code snippet
import subprocess
import shlex
cmd = # the command
suprocess.call(shlex.split(cmd))I’m getting the following error
Trailing options were found on the commandline.
The above error occurring because the shlex.split command is converting the double quotes of the part into single quote. How to avoid this from happening. Can anyone suggest me a solutions for this problem.
Check the full error trace below.
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.2 (GCC) 20140120 (Red Hat 4.8.2-15)
configuration: --prefix=/home/vkv/anaconda3
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Trailing options were found on the commandline.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'remove_takeoff.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.67.100
Duration: 00:00:14.00, start: 0.000000, bitrate: 15883 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 15881 kb/s, 20 fps, 20 tbr, 10240 tbn, 40 tbc (default)
Metadata:
handler_name : VideoHandler
Filter overlay has an unconnected output