Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (29)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP 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 (...)

Sur d’autres sites (6600)

  • How to record the bluetooth audio from my phone in my pc using ffmpeg ?

    12 septembre 2023, par Juan Inzunza

    I have my phone connected via Bluetooth to my PC and playing audio in my phone so i can hear that audio in my pc and i was trying to record that audio in my PC using ffmpeg this is the command i got so far

    


    ffmpeg -f pulse -ac 1 -ar 44100 -i alsa_input.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00.mono-fallback -f pulse -ac 2 -ar 44100 -i bluez_source.84_5F_04_75_B9_F6.a2dp_source -filter_complex amix=inputs=2 -i /dev/video5 -s 640x480 -vcodec libx264 -preset veryfast -crf 18 -acodec libmp3lame -ar 44100 -q:a 1 -pix_fmt yuv420p -aq 0 ~/Videos


    


    "bluez_source.84_5F_04_75_B9_F6.a2dp_source" is the name of the bluetooth audio source (my phone) but the problem is, if i am not playing audio on the device, just disappears when i execute this command "pactl list sources", and appears again when i play audio, so is listed when i run "pactl list sources" and i have to keep the phone playing audio so ffmpeg recognizes that device and not fail when executed.

    


    Finally my question is how can i keep that device in running state or suspended state without need to play audio all the time.

    


    gandalf@Mordor:~$ pactl list sources
Source #64
    State: IDLE
    Name: alsa_output.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00.analog-stereo.monitor
    Description: Monitor of KT USB Audio Analog Stereo
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Owner Module: 85
    Mute: no
    Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor of Sink: alsa_output.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00.analog-stereo
    Latency: 0 usec, configured 2000000 usec
    Flags: DECIBEL_VOLUME LATENCY 
    Properties:
        device.description = "Monitor of KT USB Audio Analog Stereo"
        device.class = "monitor"
        alsa.card = "1"
        alsa.card_name = "KT USB Audio"
        alsa.long_card_name = "KTMicro KT USB Audio at usb-0000:03:00.3-3, full speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:03:00.3-usb-0:3:1.0"
        sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:03:00.3/usb1/1-3/1-3:1.0/sound/card1"
        udev.id = "usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00"
        device.bus = "usb"
        device.vendor.id = "12d1"
        device.vendor.name = "Huawei Technologies Co., Ltd."
        device.product.id = "0010"
        device.product.name = "KT USB Audio"
        device.serial = "KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000-"
        device.string = "1"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
    Formats:
        pcm

Source #65
    State: SUSPENDED
    Name: alsa_input.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00.mono-fallback
    Description: KT USB Audio Mono
    Driver: module-alsa-card.c
    Sample Specification: s16le 1ch 44100Hz
    Channel Map: mono
    Owner Module: 85
    Mute: no
    Volume: mono: 65536 / 100% / 0.00 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor of Sink: n/a
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "USB Audio"
        alsa.id = "USB Audio"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "1"
        alsa.card_name = "KT USB Audio"
        alsa.long_card_name = "KTMicro KT USB Audio at usb-0000:03:00.3-3, full speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:03:00.3-usb-0:3:1.0"
        sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:03:00.3/usb1/1-3/1-3:1.0/sound/card1"
        udev.id = "usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00"
        device.bus = "usb"
        device.vendor.id = "12d1"
        device.vendor.name = "Huawei Technologies Co., Ltd."
        device.product.id = "0010"
        device.product.name = "KT USB Audio"
        device.serial = "KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000-"
        device.string = "hw:1"
        device.buffering.buffer_size = "176400"
        device.buffering.fragment_size = "88200"
        device.access_mode = "mmap+timer"
        device.profile.name = "mono-fallback"
        device.profile.description = "Mono"
        device.description = "KT USB Audio Mono"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
    Ports:
        analog-input-mic: Microphone (type: Mic, priority: 8700, availability unknown)
    Active Port: analog-input-mic
    Formats:
        pcm

Source #68
    State: RUNNING
    Name: bluez_source.84_5F_04_75_B9_F6.a2dp_source
    Description: Juan's S20 FE
    Driver: module-bluez5-device.c
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Owner Module: 23
    Mute: no
    Volume: front-left: 53151 /  81% / -5.46 dB,   front-right: 53151 /  81% / -5.46 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor of Sink: n/a
    Latency: 68928 usec, configured 68537 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY 
    Properties:
        bluetooth.protocol = "a2dp_source"
        bluetooth.codec = "sbc"
        device.description = "Juan's S20 FE"
        device.string = "84:5F:04:75:B9:F6"
        device.api = "bluez"
        device.class = "sound"
        device.bus = "bluetooth"
        device.form_factor = "phone"
        bluez.path = "/org/bluez/hci0/dev_84_5F_04_75_B9_F6"
        bluez.class = "0x5a020c"
        bluez.alias = "Juan's S20 FE"
        device.icon_name = "audio-card-bluetooth"
    Ports:
        phone-input: Phone (type: Phone, priority: 0, available)
    Active Port: phone-input
    Formats:
        pcm


    


    This is the error i am getting when there's no playing audio in my phone.

    


    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, pulse, from 'alsa_input.usb-KTMicro_KT_USB_Audio_2021-06-25-0000-0000-0000--00.mono-fallback':
  Duration: N/A, start: 1694557964.268337, bitrate: 705 kb/s
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
bluez_source.84_5F_04_75_B9_F6.a2dp_source: Input/output error



    


  • Streaming Anki Vector's camera

    25 novembre 2023, par Brendan Goode

    I 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.

    


  • Python-FFMPEG Corruption Problems

    11 juillet 2023, par Gabriel Ruben Guzman

    I'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) Error FFMPEG

    


    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&#xA;[rawvideo @ 0x55ccc0e2bb80] Invalid buffer size, packet size 691200 < expected frame_size 921600&#xA;Error while decoding stream #0:0 : Invalid argument

    &#xA;

    The code for animate_play

    &#xA;

    def animate_play(self, game_time=None, length=None, highlight_player=None,&#xA;                 commentary=True, show_spacing=None):&#xA;    """&#xA;    Method for animating plays in game.&#xA;    Outputs video file of play in {cwd}/temp.&#xA;    Individual frames are streamed directly to ffmpeg without writing them&#xA;    to the disk, which is a great speed improvement over watch_play&#xA;&#xA;    Args:&#xA;        game_time (int): time in game to start video&#xA;            (seconds into the game).&#xA;            Currently game_time can also be an tuple of length two&#xA;            with (starting_frame, ending_frame)if you want to&#xA;            watch a play using frames instead of game time.&#xA;        length (int): length of play to watch (seconds)&#xA;        highlight_player (str): If not None, video will highlight&#xA;            the circle of the inputed player for easy tracking.&#xA;        commentary (bool): Whether to include play-by-play commentary in&#xA;            the animation&#xA;        show_spacing (str) in [&#x27;home&#x27;, &#x27;away&#x27;]: show convex hull&#xA;            spacing of home or away team.&#xA;            If None, does not show spacing.&#xA;&#xA;    Returns: an instance of self, and outputs video file of play&#xA;    """&#xA;    if type(game_time) == tuple:&#xA;        starting_frame = game_time[0]&#xA;        ending_frame = game_time[1]&#xA;    else:&#xA;        game_time= self.start &#x2B;(self.quarter*720)&#xA;        end_time= self.end &#x2B;(self.quarter*720)&#xA;        length = end_time-game_time&#xA;        # Get starting and ending frame from requested &#xA;        # game_time and length&#xA;        print(&#x27;hit&#x27;)&#xA;        print(len(self.moments))&#xA;        print(game_time)&#xA;        print(end_time)&#xA;        print(length)&#xA;        print(game_time&#x2B;length)&#xA;        &#xA;        print(self.moments.game_time.min())&#xA;        print(self.moments.game_time.max())&#xA;&#xA;        sys.exit()&#xA;        starting_frame = self.moments[self.moments.game_time.round() ==&#xA;                                      game_time].index.values[0]&#xA;        ending_frame = self.moments[self.moments.game_time.round() ==&#xA;                                    game_time &#x2B; length].index.values[0]&#xA;&#xA;    # Make video of each frame&#xA;    filename = "./temp/{game_time}.mp4".format(game_time=game_time)&#xA;    if commentary:&#xA;        size = (960, 960)&#xA;    else:&#xA;        size = (480, 480)&#xA;    cmdstring = (&#x27;ffmpeg&#x27;,&#xA;                 &#x27;-y&#x27;, &#x27;-r&#x27;, &#x27;20&#x27;,  # fps&#xA;                 &#x27;-s&#x27;, &#x27;%dx%d&#x27; % size,  # size of image string&#xA;                 &#x27;-pix_fmt&#x27;, &#x27;argb&#x27;,  # Stream argb data from matplotlib&#xA;                 &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#x27;-i&#x27;, &#x27;-&#x27;,&#xA;                 &#x27;-vcodec&#x27;, &#x27;libx264&#x27;, filename)&#xA;    #print(pipe)&#xA;    #print(cmdstring)&#xA;    &#xA;    &#xA;&#xA;    # Stream plots to pipe&#xA;    pipe = Popen(cmdstring, stdin=PIPE)&#xA;    print(cmdstring)&#xA;    for frame in range(starting_frame, ending_frame):&#xA;        print(frame)&#xA;        self.plot_frame(frame, highlight_player=highlight_player,&#xA;                        commentary=commentary, show_spacing=show_spacing,&#xA;                        pipe=pipe)&#xA;    print(cmdstring)&#xA;    pipe.stdin.close()&#xA;    pipe.wait()&#xA;    return self&#xA;

    &#xA;

    The code for watch play

    &#xA;

    def watch_play(self, game_time=None, length=None, highlight_player=None,&#xA;               commentary=True, show_spacing=None):&#xA;&#xA;    """&#xA;    DEPRECIATED.  See animate_play() for similar (fastere) method&#xA;&#xA;    Method for viewing plays in game.&#xA;    Outputs video file of play in {cwd}/temp&#xA;&#xA;    Args:&#xA;        game_time (int): time in game to start video&#xA;            (seconds into the game).&#xA;            Currently game_time can also be an tuple of length&#xA;            two with (starting_frame, ending_frame) if you want&#xA;            to watch a play using frames instead of game time.&#xA;        length (int): length of play to watch (seconds)&#xA;        highlight_player (str): If not None, video will highlight&#xA;            the circle of the inputed player for easy tracking.&#xA;        commentary (bool): Whether to include play-by-play&#xA;            commentary underneath video&#xA;        show_spacing (str in [&#x27;home&#x27;, &#x27;away&#x27;]): show convex hull&#xA;            of home or away team.&#xA;            if None, does not display any convex hull&#xA;&#xA;    Returns: an instance of self, and outputs video file of play&#xA;    """&#xA;    print(&#x27;hit this point &#x27;)&#xA;    warnings.warn(("watch_play is extremely slow. "&#xA;                   "Use animate_play for similar functionality, "&#xA;                   "but greater efficiency"))&#xA;&#xA;    if type(game_time) == tuple:&#xA;        starting_frame = game_time[0]&#xA;        ending_frame = game_time[1]&#xA;    else:&#xA;        # Get starting and ending frame from requested game_time and length&#xA;        game_time= self.start &#x2B;(self.quarter*720)&#xA;        end_time= self.end &#x2B;(self.quarter*720)&#xA;        length = end_time-game_time&#xA;&#xA;&#xA;        starting_frame = self.moments[self.moments.game_time.round() ==&#xA;                                      game_time].index.values[0]&#xA;        ending_frame = self.moments[self.moments.game_time.round() ==&#xA;                                    game_time &#x2B; length].index.values[0]&#xA;    #print(self.moments.head(2))&#xA;    #print(starting_frame)&#xA;    #print(ending_frame)&#xA;    print(len(self.moments))&#xA;    # Make video of each frame&#xA;    title = str(starting_frame)&#x2B;&#x27;-&#x27;&#x2B;str(ending_frame)&#xA;    for frame in range(starting_frame, ending_frame):&#xA;        print(frame)&#xA;        self.plot_frame(frame, highlight_player=highlight_player,&#xA;                        commentary=commentary, show_spacing=show_spacing)&#xA;    command = (&#x27;ffmpeg -framerate 20 -start_number {starting_frame} &#x27;&#xA;               &#x27;-i %d.png -c:v libx264 -r 30 -pix_fmt yuv420p -vf &#x27;&#xA;               &#x27;"scale=trunc(iw/2)*2:trunc(ih/2)*2" {title}&#x27;&#xA;               &#x27;.mp4&#x27;).format(starting_frame=starting_frame,title=title)&#xA;    os.chdir(&#x27;temp&#x27;)&#xA;    os.system(command)&#xA;    os.chdir(&#x27;..&#x27;)&#xA;&#xA;    # Delete images&#xA;    for file in os.listdir(&#x27;./temp&#x27;):&#xA;        if os.path.splitext(file)[1] == &#x27;.png&#x27;:&#xA;            os.remove(&#x27;./temp/{file}&#x27;.format(file=file))&#xA;&#xA;    return self&#x27;&#xA;

    &#xA;