
Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (58)
-
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 (...) -
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 -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
Sur d’autres sites (8700)
-
Python animation saves only one single frame
5 octobre 2015, par JohnNDI’m trying to save a python animation as a video file. The animation itself works fine with show(). But when I use save() I get a video file containing only one frame which stays on for the duration of the video. The duration itself seems correct (2 minutes).
Here’s my script, it gets some data from files that are read by custom functions then use the data to make an animation. I’ve tried various alternatives like specifying ffmpeg as writer or using Agg as backend. So far it all gives the same result. Is there some obvious misuse of the animation module ?#!/usr/bin/env python
import sys
import os
import matplotlib
#matplotlib.use("Agg")
import numpy as np
import math as mh
from pylab import *
from matplotlib import animation as animation
#plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'
sys.path.append('/home/jseverin/bin/myPythonScripts/')
import temp_profile_v4
##########################################################################
# Function definition #
##########################################################################
##########################################################################
# Main #
##########################################################################
def main(args):
log_file = args[1]
lz, coords, instant_profiles, fig1, Nlayers = temp_profile_v4.main(["temp_profile_v4.py", "-i", log_file])
close(fig1)
# Layer thickness in angstroms
thickA = lz/Nlayers
thickA2 = thickA/2
# We need to slice the array
# We choose the width of the exclusion area as a fraction of the source/sink width
fract = 1.0
safeDist = fract*thickA
#sliced_coords, sliced_temps = slice_prof(safeDist, thickA2, lz, slice_coords, slice_temps)
Nframes = int(len(instant_profiles)/2)
# Plot setup
fig = figure(figsize=(12,8.5)) # initialise la figure
line, = plot([],[], '-', linewidth=1.5, label = "T(z)")
ymax = 0
for prof in instant_profiles :
dummy = max(prof)
if dummy > ymax :
ymax = dummy
ymin = 999999999
for prof in instant_profiles :
dummy = min(prof)
if dummy < ymin :
ymin = dummy
xlim([-0.1, lz])
ylim([ymin, ymax])
xlabel(r'z ($\AA$)', fontsize=14)
ylabel('Temperature (K)', fontsize=14)
# Show source and sink on graph
axvspan(lz/4-thickA2, lz/4+thickA2, alpha=0.2, color='black', label=r"source/sink (a = %d $\AA$)" % int(round(thickA)))
axvspan(3*lz/4-thickA2, 3*lz/4+thickA2, alpha=0.2, color='black')
axvline(x=lz/4 + thickA2 + safeDist, linestyle='--', color='k')
axvline(x=3*lz/4 - thickA2 - safeDist, linestyle='--', color='k')
# fonction a definir quand blit=True
# cree l'arriere de l'animation qui sera present sur chaque image
def init():
line.set_data([],[])
return line,
def animate(i):
step = 2*i
line.set_data(coords, instant_profiles[step])
return line,
ani = animation.FuncAnimation(fig, animate, init_func=init, frames=Nframes, blit=True, interval=20, repeat=False)
show()
#FFwriter = animation.FFMpegWriter()
#ani.save('dynamic_profile.mp4', writer = 'ffmpeg')
# Set up formatting for the movie files
#Writer = animation.writers['ffmpeg']
#writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
#ani.save('animation.mp4', writer=writer)
ani.save('animation.mp4', fps=15)
# End main
if __name__=="__main__":
main(sys.argv) -
Replace Special Characters In Batch-File Variable Feeding ffmpeg program
14 janvier 2019, par whereswallerI am attempting to write a batch-file that leverages
ffmpeg.exe
to convert all files in a folder structure to mp3 format (specifically 128 KBps).My batch-file is presently unable to process filenames (constructed by concatenating the
%_SOURCE%
and%%~F
variables) containing certain special characters generating the following errors :No such file or directory
…
ellipsis sign–
en dash—
em dash−
minus sign
Invalid argument
‘
and’
curved single quotation marks“
and”
curved double quotation marks
Invalid argument (yet sometimes passes depending on where symbol is in the filename, for example, seems to work if placed between the
n
andt
ofDont
inC:\Users\Test\Documents\Input\Peter Bjorn And John - I Know You Dont Love Me.mp3
)-
hyphen!
exclamation mark~
tilde'
non-curved single quotation mark=
equals sign+
plus sign%
percentage sign(
open bracket
How can I modify my batch-file script so that the
%%~F
variable escapes these characters correctly ?Example current filename input :
C:\Users\Test\Documents\Input\Peter Bjorn And John - I Know You Don't Love Me.mp3
Example desired filename input :
C:\Users\Test\Documents\Input\Peter Bjorn And John - I Know You Don"^'"t Love Me.mp3
Script (see line beginning
C:\ffmpeg\bin\ffmpeg.exe
) :@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Define constants here:
set "_SOURCE=C:\Users\Test\Documents\Input" & rem // (absolute source path)
set "_TARGET=C:\Users\Test\Documents\Output" & rem // (absolute target path)
set "_PATTERN=*.*" & rem // (pure file pattern for input files)
set "_FILEEXT=.mp3" & rem // (pure file extension of output files)
pushd "%_TARGET%" || exit /B 1
for /F "delims=" %%F in ('
cd /D "%_SOURCE%" ^&^& ^(rem/ list but do not copy: ^
^& xcopy /L /S /Y /I ".\%_PATTERN%" "%_TARGET%" ^
^| find ".\" ^& rem/ remove summary line;
^)
') do (
2> nul mkdir "%%~dpF."
rem // Set up the correct `ffmpeg` command line here:
set "FFREPORT=file=C\:\\Users\\Test\\Documents\\Output\\ffreport-%%~F.log:level=32"
"C:\ffmpeg\bin\ffmpeg.exe" -report -n -i "%_SOURCE%\%%~F" -vn -c:a libmp3lame -b:a 128k "%%~dpnF%_FILEEXT%"
if not errorlevel 1 if exist "%%~dpnF%_FILEEXT%" del /f /q "%_SOURCE%\%%~F"
)
popd
endlocal
pause -
Unable to Create Videos on OpenCV (VideoCapture Class) for Mac OS
17 janvier 2017, par MBTHi Programming Guru’s,
I am using Mac OS 10.12.1 with OpenCV 3.0. I tried to capture live videos from webcam and try to save it as a video file. I know that many have tried out this but there were not a clear solution specifically to Mac OS.
Some have said to use FFMPEG in order to do in Mac OS, other have mentioned to try with different codec in CV_FOURCC. I tried both and I was not able to get the desired results. So I am bit confused by reading all the stuffs.
Below is a C++ code :
#include <opencv2></opencv2>opencv.hpp>
#include <iostream>
#include
using namespace cv;
using namespace std;
int main(int, char**)
{
Mat src;
// use default camera as video source
VideoCapture cap(0);
// check if we succeeded
if (!cap.isOpened()) {
cerr << "ERROR! Unable to open camera\n";
return -1;
}
// get one frame from camera to know frame size and type
cap >> src;
// check if we succeeded
if (src.empty()) {
cerr << "ERROR! blank frame grabbed\n";
return -1;
}
bool isColor = (src.type() == CV_8UC3);
//--- INITIALIZE VIDEOWRITER
VideoWriter writer;
int codec = CV_FOURCC('H', '2', '6', '4'); // select desired codec (must be available at runtime)
double fps = 25.0; // framerate of the created video stream
string filename = "./live.avi"; // name of the output video file
writer.open(filename, codec, fps, src.size(), isColor);
// check if we succeeded
if (!writer.isOpened()) {
cerr << "Could not open the output video file for write\n";
return -1;
}
//--- GRAB AND WRITE LOOP
cout << "Writing videofile: " << filename << endl
<< "Press any key to terminate" << endl;
for (;;)
{
// check if we succeeded
if (!cap.read(src)) {
cerr << "ERROR! blank frame grabbed\n";
break;
}
// encode the frame into the videofile stream
writer.write(src);
// show live and wait for a key with timeout long enough to show images
imshow("Live", src);
if (waitKey(5) >= 0)
break;
}
// the videofile will be closed and released automatically in VideoWriter destructor
return 0;
}
</iostream>When I run the above code, I see a video is created with only a single frame.
I tried with Many Video CODEC like ’A’,’V’,’C’,’1’, ’M’,’P’,’4’,’V’, ’H’,’2’,’6’,’4’or ’X’,’2’,’6’,’4’. But not works with MAC.
It would be really wonderful if you can suggest me the correct way to solve this issue.
Thank You