
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (55)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (7867)
-
Ffmpeg not fully functioning
26 août 2014, par JoshuaHello i have problem with ffmpeg i’m using phpvibe cms already asked in their forums but they don’t know the answer which leads me that it’s probably my fault so the problem is when i upload :
6 seconds avi video which weights 817 KB it uploads perfectlly plays like it should run.
However when i try upload 12mb avi sample i see that it does not work in folder where should be that video converted it shows 0kb size
That means it didn’t start converting somewhow i think this is ffmpeg issue also i have spoted that my ffmpeg is placed in /usr/local/bin/ and in phpvibe cms systems there is different location for ffmpeg it looks like this : Img link
Why when i upload small avi video it converts good and when i try longer it fails maybe it converts while upload process is going on but than why it shows 0b in folder where converted videos should be placed ?
P.s i tried couple avi videos that weights more than 10 mb same thing and my code for ffmpeg conversation is :
$output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 -movflags faststart {output}.mp4";
Also tried :
output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 {output}.mp4 2>&1";
Same thing + im using Debian 7 Wheezy. Thanks !
EDIT :
i have made a test script it gives this output :
array(21) {
[0]=>
string(83) "ffmpeg version git-2014-08-25-bb29896 Copyright (c) 2000-2014 the FFmpeg developers"
[1]=>
string(61) " built on Aug 25 2014 19:52:12 with gcc 4.7 (Debian 4.7.2-5)"
[2]=>
string(62) " configuration: --enable-shared --enable-libx264 --enable-gpl"
[3]=>
string(40) " libavutil 54. 7.100 / 54. 7.100"
[4]=>
string(40) " libavcodec 56. 0.101 / 56. 0.101"
[5]=>
string(40) " libavformat 56. 3.100 / 56. 3.100"
[6]=>
string(40) " libavdevice 56. 0.100 / 56. 0.100"
[7]=>
string(40) " libavfilter 5. 0.103 / 5. 0.103"
[8]=>
string(40) " libswscale 3. 0.100 / 3. 0.100"
[9]=>
string(40) " libswresample 1. 1.100 / 1. 1.100"
[10]=>
string(40) " libpostproc 53. 0.100 / 53. 0.100"
[11]=>
string(31) "Input #0, avi, from 'test.avi':"
[12]=>
string(11) " Metadata:"
[13]=>
string(36) " encoder : Nandub v1.0rc2"
[14]=>
string(60) " Duration: 00:01:09.78, start: 0.000000, bitrate: 1517 kb/s"
[15]=>
string(126) " Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 640x352, 1279 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc"
[16]=>
string(83) " Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 222 kb/s"
[17]=>
string(87) "[libx264 @ 0x6c31e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX"
[18]=>
string(44) "[libx264 @ 0x6c31e0] profile High, level 3.0"
[19]=>
string(649) "[libx264 @ 0x6c31e0] 264 - core 124 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[20]=>
string(131) "[aac @ 0x6c3c20] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it."
}
int(1)i get this output with this :
$output ="{ffmpeg-cmd} -y -i {input} {output}.mp4 2<&1"";
simple ffmpeg command also tried :
$output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 {output}.mp4 2>&1";
With this command it gives this output :
array(21) {
[0]=>
string(83) "ffmpeg version git-2014-08-25-bb29896 Copyright (c) 2000-2014 the FFmpeg developers"
[1]=>
string(61) " built on Aug 25 2014 19:52:12 with gcc 4.7 (Debian 4.7.2-5)"
[2]=>
string(62) " configuration: --enable-shared --enable-libx264 --enable-gpl"
[3]=>
string(40) " libavutil 54. 7.100 / 54. 7.100"
[4]=>
string(40) " libavcodec 56. 0.101 / 56. 0.101"
[5]=>
string(40) " libavformat 56. 3.100 / 56. 3.100"
[6]=>
string(40) " libavdevice 56. 0.100 / 56. 0.100"
[7]=>
string(40) " libavfilter 5. 0.103 / 5. 0.103"
[8]=>
string(40) " libswscale 3. 0.100 / 3. 0.100"
[9]=>
string(40) " libswresample 1. 1.100 / 1. 1.100"
[10]=>
string(40) " libpostproc 53. 0.100 / 53. 0.100"
[11]=>
string(31) "Input #0, avi, from 'test.avi':"
[12]=>
string(11) " Metadata:"
[13]=>
string(36) " encoder : Nandub v1.0rc2"
[14]=>
string(60) " Duration: 00:01:09.78, start: 0.000000, bitrate: 1517 kb/s"
[15]=>
string(126) " Stream #0:0: Video: msmpeg4v3 (DIV3 / 0x33564944), yuv420p, 640x352, 1279 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc"
[16]=>
string(83) " Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 222 kb/s"
[17]=>
string(88) "[libx264 @ 0x13046c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX"
[18]=>
string(45) "[libx264 @ 0x13046c0] profile High, level 3.0"
[19]=>
string(650) "[libx264 @ 0x13046c0] 264 - core 124 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[20]=>
string(132) "[aac @ 0x13055a0] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it."
}
int(1)And also tried thi command :
$output ="{ffmpeg-cmd} -i {input} -vcodec libx264 -s {ffmpeg-vsize} -threads 4 -movflags faststart {output}.mp4";
And with this it gives :
array(0) {
}
int(1)in all cases file that weitghs 12 mb doest not convert it’s 0kb in ftp
-
Python-FFMPEG Corruption Problems
11 juillet 2023, par Gabriel Ruben GuzmanI'm repurposing some python code to generate gifs/mp4s showcasing nba player movements dot form. (With the 'frames' used in the gifs being generated by matplotlib).


The repo comes with two different functions for generating the gifs, watch_play and animate_play. Both of which use python command line functionalities to run ffmpeg and generate the mp4s.
I've been able to use the watch_play succesfully, bot every time I try using animate_play, which according to the documention is meant to be significantly faster than watch play, I run into the error showcased here.(I printed the cmd string being passed into the pipe, in the hopes it would make debugging easier)


I've tried generating gifs/mp4s of various size and added a decent bit of code to lessen the volume of data being processed. (I'm essentially repurposing the code just to generate clips, so I've been able to remove a lot of the pbp/tracking data logs to speed up the run time) But no matter what I've done, gotten some variation of the screenshotted error.


pipe: : corrupt input packet in stream 0
[rawvideo @ 0x55ccc0e2bb80] Invalid buffer size, packet size 691200 < expected frame_size 921600
Error while decoding stream #0:0 : Invalid argument


The code for animate_play


def animate_play(self, game_time=None, length=None, highlight_player=None,
 commentary=True, show_spacing=None):
 """
 Method for animating plays in game.
 Outputs video file of play in {cwd}/temp.
 Individual frames are streamed directly to ffmpeg without writing them
 to the disk, which is a great speed improvement over watch_play

 Args:
 game_time (int): time in game to start video
 (seconds into the game).
 Currently game_time can also be an tuple of length two
 with (starting_frame, ending_frame)if you want to
 watch a play using frames instead of game time.
 length (int): length of play to watch (seconds)
 highlight_player (str): If not None, video will highlight
 the circle of the inputed player for easy tracking.
 commentary (bool): Whether to include play-by-play commentary in
 the animation
 show_spacing (str) in ['home', 'away']: show convex hull
 spacing of home or away team.
 If None, does not show spacing.

 Returns: an instance of self, and outputs video file of play
 """
 if type(game_time) == tuple:
 starting_frame = game_time[0]
 ending_frame = game_time[1]
 else:
 game_time= self.start +(self.quarter*720)
 end_time= self.end +(self.quarter*720)
 length = end_time-game_time
 # Get starting and ending frame from requested 
 # game_time and length
 print('hit')
 print(len(self.moments))
 print(game_time)
 print(end_time)
 print(length)
 print(game_time+length)
 
 print(self.moments.game_time.min())
 print(self.moments.game_time.max())

 sys.exit()
 starting_frame = self.moments[self.moments.game_time.round() ==
 game_time].index.values[0]
 ending_frame = self.moments[self.moments.game_time.round() ==
 game_time + length].index.values[0]

 # Make video of each frame
 filename = "./temp/{game_time}.mp4".format(game_time=game_time)
 if commentary:
 size = (960, 960)
 else:
 size = (480, 480)
 cmdstring = ('ffmpeg',
 '-y', '-r', '20', # fps
 '-s', '%dx%d' % size, # size of image string
 '-pix_fmt', 'argb', # Stream argb data from matplotlib
 '-f', 'rawvideo','-i', '-',
 '-vcodec', 'libx264', filename)
 #print(pipe)
 #print(cmdstring)
 
 

 # Stream plots to pipe
 pipe = Popen(cmdstring, stdin=PIPE)
 print(cmdstring)
 for frame in range(starting_frame, ending_frame):
 print(frame)
 self.plot_frame(frame, highlight_player=highlight_player,
 commentary=commentary, show_spacing=show_spacing,
 pipe=pipe)
 print(cmdstring)
 pipe.stdin.close()
 pipe.wait()
 return self



The code for watch play


def watch_play(self, game_time=None, length=None, highlight_player=None,
 commentary=True, show_spacing=None):

 """
 DEPRECIATED. See animate_play() for similar (fastere) method

 Method for viewing plays in game.
 Outputs video file of play in {cwd}/temp

 Args:
 game_time (int): time in game to start video
 (seconds into the game).
 Currently game_time can also be an tuple of length
 two with (starting_frame, ending_frame) if you want
 to watch a play using frames instead of game time.
 length (int): length of play to watch (seconds)
 highlight_player (str): If not None, video will highlight
 the circle of the inputed player for easy tracking.
 commentary (bool): Whether to include play-by-play
 commentary underneath video
 show_spacing (str in ['home', 'away']): show convex hull
 of home or away team.
 if None, does not display any convex hull

 Returns: an instance of self, and outputs video file of play
 """
 print('hit this point ')
 warnings.warn(("watch_play is extremely slow. "
 "Use animate_play for similar functionality, "
 "but greater efficiency"))

 if type(game_time) == tuple:
 starting_frame = game_time[0]
 ending_frame = game_time[1]
 else:
 # Get starting and ending frame from requested game_time and length
 game_time= self.start +(self.quarter*720)
 end_time= self.end +(self.quarter*720)
 length = end_time-game_time


 starting_frame = self.moments[self.moments.game_time.round() ==
 game_time].index.values[0]
 ending_frame = self.moments[self.moments.game_time.round() ==
 game_time + length].index.values[0]
 #print(self.moments.head(2))
 #print(starting_frame)
 #print(ending_frame)
 print(len(self.moments))
 # Make video of each frame
 title = str(starting_frame)+'-'+str(ending_frame)
 for frame in range(starting_frame, ending_frame):
 print(frame)
 self.plot_frame(frame, highlight_player=highlight_player,
 commentary=commentary, show_spacing=show_spacing)
 command = ('ffmpeg -framerate 20 -start_number {starting_frame} '
 '-i %d.png -c:v libx264 -r 30 -pix_fmt yuv420p -vf '
 '"scale=trunc(iw/2)*2:trunc(ih/2)*2" {title}'
 '.mp4').format(starting_frame=starting_frame,title=title)
 os.chdir('temp')
 os.system(command)
 os.chdir('..')

 # Delete images
 for file in os.listdir('./temp'):
 if os.path.splitext(file)[1] == '.png':
 os.remove('./temp/{file}'.format(file=file))

 return self'



-
FFMPEG to add audio to video at specific intervals
13 juillet 2023, par biswaI have a audio of 2 mints . How to add it to a longer video of say 10 mints at some specific intervals using ffmpeg. Say after 2 mints of the audio play there is a 1 minute gap and then it plays again . I tried to add it but it plays only once at the start of the video