
Recherche avancée
Médias (91)
-
DJ Z-trip - Victory Lap : The Obama Mix Pt. 2
15 septembre 2011
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Matmos - Action at a Distance
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Danger Mouse & Jemini - What U Sittin’ On ? (starring Cee Lo and Tha Alkaholiks)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Cornelius - Wataridori 2
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Rapture - Sister Saviour (Blackstrobe Remix)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (47)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
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 (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (9168)
-
How to create effect same video with FFmpeg
29 juin 2023, par Sang VoHow to make a video from an image with a drag effect like this one in FFmpeg :


https://www.youtube.com/watch?v=zC6qbpe3FyE&ab_channel=CloudMood



I tried to zoom in zoom out effects but not the same with video


ffmpeg -loop 1 -i photo.jpg -vf "zoompan=z='min(zoom+0.001,1.2)':x='if(gte(zoom,1.2),x+2,x-1)':y='if(gte(zoom,1.2),y+2,y-1)':d=10*25,framerate=25,scale=1920:1080" -c:v libx264 -t 10 -pix_fmt yuv420p -s 1920x1080 output.mp4



-
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'



-
Streaming Anki Vector's camera
25 novembre 2023, par Brendan GoodeI am trying to stream my robot to Remo.tv with my Vector robot. The website recognizes I am going live but does not stream what the robots camera is seeing. I have confirmed the camera works by a local application that runs the SDK. The very end of the code is what is giving issues, it appears somebody ripped code from Cozmo and attempted to paste it into a Vector file. The problem is it seems like the camera is taking pictures and we reach the point where it attempts to send photo but fails ?


# This is a dummy file to allow the automatic loading of modules without error on none.
import anki_vector
import atexit
import time
import _thread as thread
import logging
import networking

log = logging.getLogger('RemoTV.vector')
vector = None
reserve_control = None
robotKey = None
volume = 100 #this is stupid, but who cares
annotated = False

def connect():
 global vector
 global reserve_control

 log.debug("Connecting to Vector")
 vector = anki_vector.AsyncRobot()
 vector.connect()
 #reserve_control = anki_vector.behavior.ReserveBehaviorControl()
 
 atexit.register(exit)

 return(vector)

def exit():
 log.debug("Vector exiting")
 vector.disconnect()
 
def setup(robot_config):
 global forward_speed
 global turn_speed
 global volume
 global vector
 global charge_high
 global charge_low
 global stay_on_dock

 global robotKey
 global server
 global no_mic
 global no_camera
 global ffmpeg_location
 global v4l2_ctl_location
 global x_res
 global y_res
 
 robotKey = robot_config.get('robot', 'robot_key')

 if robot_config.has_option('misc', 'video_server'):
 server = robot_config.get('misc', 'video_server')
 else:
 server = robot_config.get('misc', 'server')
 
 no_mic = robot_config.getboolean('camera', 'no_mic')
 no_camera = robot_config.getboolean('camera', 'no_camera')

 ffmpeg_location = robot_config.get('ffmpeg', 'ffmpeg_location')
 v4l2_ctl_location = robot_config.get('ffmpeg', 'v4l2-ctl_location')

 x_res = robot_config.getint('camera', 'x_res')
 y_res = robot_config.getint('camera', 'y_res')


 if vector == None:
 vector = connect()

 #x mod_utils.repeat_task(30, check_battery, coz)

 if robot_config.has_section('cozmo'):
 forward_speed = robot_config.getint('cozmo', 'forward_speed')
 turn_speed = robot_config.getint('cozmo', 'turn_speed')
 volume = robot_config.getint('cozmo', 'volume')
 charge_high = robot_config.getfloat('cozmo', 'charge_high')
 charge_low = robot_config.getfloat('cozmo', 'charge_low')
 stay_on_dock = robot_config.getboolean('cozmo', 'stay_on_dock')

# if robot_config.getboolean('tts', 'ext_chat'): #ext_chat enabled, add motor commands
# extended_command.add_command('.anim', play_anim)
# extended_command.add_command('.forward_speed', set_forward_speed)
# extended_command.add_command('.turn_speed', set_turn_speed)
# extended_command.add_command('.vol', set_volume)
# extended_command.add_command('.charge', set_charging)
# extended_command.add_command('.stay', set_stay_on_dock)

 vector.audio.set_master_volume(volume) # set volume

 return
 
def move(args):
 global charging
 global low_battery
 command = args['button']['command']

 try:
 if vector.status.is_on_charger and not charging:
 if low_battery:
 print("Started Charging")
 charging = 1
 else:
 if not stay_on_dock:
 vector.drive_off_charger_contacts().wait_for_completed()

 if command == 'f':
 vector.behavior.say_text("Moving {}".format(command))

 #causes delays #coz.drive_straight(distance_mm(10), speed_mmps(50), False, True).wait_for_completed()
 vector.motors.set_wheel_motors(forward_speed, forward_speed, forward_speed*4, forward_speed*4 )
 time.sleep(0.7)
 vector.motors.set_wheel_motors(0, 0)
 elif command == 'b':
 #causes delays #coz.drive_straight(distance_mm(-10), speed_mmps(50), False, True).wait_for_completed()
 vector.motors.set_wheel_motors(-forward_speed, -forward_speed, -forward_speed*4, -forward_speed*4 )
 time.sleep(0.7)
 vector.motors.set_wheel_motors(0, 0)
 elif command == 'l':
 #causes delays #coz.turn_in_place(degrees(15), False).wait_for_completed()
 vector.motors.set_wheel_motors(-turn_speed, turn_speed, -turn_speed*4, turn_speed*4 )
 time.sleep(0.5)
 vector.motors.set_wheel_motors(0, 0)
 elif command == 'r':
 #causes delays #coz.turn_in_place(degrees(-15), False).wait_for_completed()
 vector.motors.set_wheel_motors(turn_speed, -turn_speed, turn_speed*4, -turn_speed*4 )
 time.sleep(0.5)
 vector.motors.set_wheel_motors(0, 0)

 #move lift
 elif command == 'w':
 vector.behavior.say_text("w")
 vector.set_lift_height(height=1).wait_for_completed()
 elif command == 's':
 vector.behavior.say_text("s")
 vector.set_lift_height(height=0).wait_for_completed()

 #look up down
 #-25 (down) to 44.5 degrees (up)
 elif command == 'q':
 #head_angle_action = coz.set_head_angle(degrees(0))
 #clamped_head_angle = head_angle_action.angle.degrees
 #head_angle_action.wait_for_completed()
 vector.behaviour.set_head_angle(45)
 time.sleep(0.35)
 vector.behaviour.set_head_angle(0)
 elif command == 'a':
 #head_angle_action = coz.set_head_angle(degrees(44.5))
 #clamped_head_angle = head_angle_action.angle.degrees
 #head_angle_action.wait_for_completed()
 vector.behaviour.set_head_angle(-22.0)
 time.sleep(0.35)
 vector.behaviour.set_head_angle(0)
 
 #things to say with TTS disabled
 elif command == 'sayhi':
 tts.say( "hi! I'm cozmo!" )
 elif command == 'saywatch':
 tts.say( "watch this" )
 elif command == 'saylove':
 tts.say( "i love you" )
 elif command == 'saybye':
 tts.say( "bye" )
 elif command == 'sayhappy':
 tts.say( "I'm happy" )
 elif command == 'saysad':
 tts.say( "I'm sad" )
 elif command == 'sayhowru':
 tts.say( "how are you?" )
 except:
 return(False)
 return

def start():
 log.debug("Starting Vector Video Process")
 try:
 thread.start_new_thread(video, ())
 except KeyboardInterrupt as e:
 pass 
 return
 
def video():
 global vector
 # Turn on image receiving by the camera
 vector.camera.init_camera_feed()

 vector.behavior.say_text("hey everyone, lets robot!")

 while True:
 time.sleep(0.25)

 from subprocess import Popen, PIPE
 from sys import platform

 log.debug("ffmpeg location : {}".format(ffmpeg_location))

# import os
# if not os.path.isfile(ffmpeg_location):
# print("Error: cannot find " + str(ffmpeg_location) + " check ffmpeg is installed. Terminating controller")
# thread.interrupt_main()
# thread.exit()

 while not networking.authenticated:
 time.sleep(1)

 p = Popen([ffmpeg_location, '-y', '-f', 'image2pipe', '-vcodec', 'png', '-r', '25', '-i', '-', '-vcodec', 'mpeg1video', '-r', '25', "-f", "mpegts", "-headers", "\"Authorization: Bearer {}\"".format(robotKey), "http://{}:1567/transmit?name={}-video".format(server, networking.channel_id)], stdin=PIPE)
 #p = Popen([ffmpeg_location, '-nostats', '-y', '-f', 'image2pipe', '-vcodec', 'png', '-r', '25', '-i', '-', '-vcodec', 'mpeg1video', '-r', '25','-b:v', '400k', "-f","mpegts", "-headers", "\"Authorization: Bearer {}\"".format(robotKey), "http://{}/transmit?name=rbot-390ddbe0-f1cc-4710-b3f1-9f477f4875f9-video".format(server)], stdin=PIPE)
 #p = Popen([ffmpeg_location, '-y', '-f', 'image2pipe', '-vcodec', 'png', '-r', '25', '-i', '-', '-vcodec', 'mpeg1video', '-r', '25', "-f", "mpegts", "-headers", "\"Authorization: Bearer {}\"".format(robotKey), "http://{}/transmit?name=rbot-390ddbe0-f1cc-4710-b3f1-9f477f4875f9-video".format(server, networking.channel_id)], stdin=PIPE)
 print(vector)
 image = vector.camera.latest_image
 image.raw_image.save("test.png", 'PNG')
 try:
 while True:
 if vector:
 image = vector.camera.latest_image
 if image:
 if annotated:
 image = image.annotate_image()
 else:
 image = image.raw_image
 print("attempting to write image")
 image.save(p.stdin, 'PNG')

 else:
 time.sleep(.1)
 log.debug("Lost Vector object, terminating video stream")
 p.stdin.close()
 p.wait()
 except Exception as e:
 log.debug("Vector Video Exception! {}".format(e))
 p.stdin.close()
 p.wait()
 pass 
 



Here is the error we get


[vost#0:0/mpeg1video @ 000001c7153c1cc0] Error submitting a packet to the muxer: Error number -10053 occurred
[out#0/mpegts @ 000001c713448480] Error muxing a packet
[out#0/mpegts @ 000001c713448480] Error writing trailer: Error number -10053 occurred
[http @ 000001c7134cab00] URL read error: Error number -10053 occurred
[out#0/mpegts @ 000001c713448480] Error closing file: Error number -10053 occurred
[out#0/mpegts @ 000001c713448480] video:56kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame= 25 fps=0.0 q=2.0 Lsize= 53kB time=00:00:01.32 bitrate= 325.9kbits/s speed=7.05x
Conversion failed!

attempting to write image



You can see our attempts to fix by commented out code in the #p section at the bottom.