
Recherche avancée
Médias (91)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (28)
-
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
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 (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (3271)
-
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 With PHP Upload
27 décembre 2014, par Will S.I’ve created an upload form that uses Ajax to dynamically upload image files to my webserver, and then uses shell_exec and ffmpeg to resize the images (and convert them to jpg, if they are already the correct size), and then save the resulting file. I’m getting really strange behaviour with it. It works about 50% of the time (so far I’ve only tested with JPG and PNG files). Whenever it fails, I get this results :
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 23 2014 16:55:38 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
/tmp/phpU0pnje: Invalid data found when processing inputHere’s the PHP code :
if ($file_info[0] == 'image'){
$image_info = getimagesize($_FILES['upload_media_hidden']['tmp_name'][$i]);
$longest_edge = ($image_info[0] > $image_info[1]) ? $image_info[0] : $image_info[1];
$aspect_ratio = $image_info[0]/$image_info[1];
$aspect_ratio_s = ($image_info[0] > $image_info[1]) ? '200x' . (int)(200/$aspect_ratio) : (int)(200*$aspect_ratio) . 'x200';
$aspect_ratio_m = ($image_info[0] > $image_info[1]) ? '400x' . (int)(400/$aspect_ratio) : (int)(400*$aspect_ratio) . 'x400';
$aspect_ratio_l = ($image_info[0] > $image_info[1]) ? '700x' . (int)(700/$aspect_ratio) : (int)(700*$aspect_ratio) . 'x700';
if ($longest_edge > 200){
$file_s = shell_exec('ffmpeg -i ' . escapeshellarg($_FILES['upload_media_hidden']['tmp_name'][$i]) . ' -f image2 -s ' . $aspect_ratio_s . ' - 2>&1');
}
................more processing belowSo the ffmpeg command essentially looks like this :
ffmpeg -i ’SOMEFILE.jpg’ -f image2 -s 400x200 -
When I run that command in bash to the actual file (not the temporary file when I upload it to my form), it works fine. I’m guessing the issue is with the pipe, but I’m not sure. Any ideas ?
Thanks !
Update :
When I run this code :if ($file_info[0] == 'image'){
$image_info = getimagesize($_FILES['upload_media_hidden']['tmp_name'][$i]);
$longest_edge = ($image_info[0] > $image_info[1]) ? $image_info[0] : $image_info[1];
$aspect_ratio = $image_info[0]/$image_info[1];
$aspect_ratio_s = ($image_info[0] > $image_info[1]) ? '200x' . (int)(200/$aspect_ratio) : (int)(200*$aspect_ratio) . 'x200';
$aspect_ratio_m = ($image_info[0] > $image_info[1]) ? '400x' . (int)(400/$aspect_ratio) : (int)(400*$aspect_ratio) . 'x400';
$aspect_ratio_l = ($image_info[0] > $image_info[1]) ? '700x' . (int)(700/$aspect_ratio) : (int)(700*$aspect_ratio) . 'x700';
if ($longest_edge > 200){
move_uploaded_file($_FILES['upload_media_hidden']['tmp_name'][$i],'/tmp/TEST.jpg');
system('ffmpeg -i /tmp/TEST.jpg -f image2 -s ' . $aspect_ratio_s . ' - 2>&1');
$file_s = system('ffmpeg -i ' . escapeshellarg($_FILES['upload_media_hidden']['tmp_name'][$i]) . ' -f image2 -s ' . $aspect_ratio_s . ' - 2>&1');I get this result from php :
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 23 2014 16:55:38 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
Input #0, image2, from '/tmp/TEST.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 54530 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1024x1432 [SAR 1:1 DAR 128:179], 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x2bce0c0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'pipe:':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: mjpeg, yuvj420p(pc), 143x200 [SAR 25600:25597 DAR 128:179], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.13.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
Press [q] to stop, [?] for help
�����JFIF��d�c������Lavc56.13.100����C�
----FILE OUTPUT...edited out for clarity---
���frame= 1 fps=0.0 q=3.7 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 23 2014 16:55:38 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
/tmp/phpxqYzHN: No such file or directory
/tmp/phpxqYzHN: No such file or directorySo it seems to work if I move the file first ? It’s really important that I don’t have any extra disk io, so this solution wouldn’t be acceptable...
SOLUTION :
So the problem was that ffmpeg was not able to recognize the input file type, since PHP’s tmp files don’t end with an extension (seems like a bug that ffmpeg looks at the extension rather than the internal mime type/headers). The solution was that I needed to add "-f image2" to the beginning of my command, so it ended up looking something like this :ffmpeg -f image2 -i '/tmp/PHP_TMP_FILE' -f image2 -s 400x200 -
Hopefully this will save someone the many hours it took me to figure this out...
-
Where does FFMPEG store temporary files in Linux ?
8 juillet 2023, par 001121100I canceled the conversion of a very large file in ffmpeg. The incomplete file is taking up almost 200GB on my disk but it does not exist in the directory I was working in and I can't find it anywhere. Where does ffmpeg store temporary, incomplete, or canceled files ?


(I've had a similar problem in the past when running a file recovery program - I canceled the recovery and the files disappeared. They are simply taking up "ghost" space on the directory and can't be located.)


I've tried searching for the filename, clearing the trash, rebooting.