Recherche avancée

Médias (91)

Autres articles (41)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Supporting all media types

    13 avril 2011, par

    Unlike 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 (7528)

  • Read RTSP stream in Python

    15 avril 2020, par pooorman

    I want to read RTSP stream with low latency. I use this code read frames in 100ms 200ms.
But this command will failed sometimes when restart program. There are four subprocess that read stream, 3 are success and 1 is failed. Is my command wrong ?

    



    ffmpeg_cmd = ["ffmpeg", "-v", "debug", "-y",
                        "-skip_initial_bytes", "2000000",
                        "-c:v",  "h264",
                        "-vsync", "1",
                        "-flags", "low_delay",
                        "-fflags", "nobuffer",
                        "-analyzeduration", "100000",
                        "-max_delay", "100000",
                        "-reorder_queue_size", "10000",
                        "-rtsp_transport", "tcp",
                        "-i", "rtsp://xx:xx@ip/streaming/channels/101",
                        "-s", "1280x720",
                        "-preset", "ultrafast",
                        "-tune", "zerolatency",
                        "-f", "image2pipe",
                        "-pix_fmt", "rgb24",
                        "-vcodec", "rawvideo",
                        "-r", "25",
                        "-"]
ffmpeg = sp.Popen(ffmpeg_cmd, stdout=sp.PIPE, bufsize=1024)
x = ffmpeg.stdout.read(int(w*h*3))


    



    Error message :

    



    Codec AVOption preset (Configuration preset) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption tune (Tune the encoding to a specific scenario) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
detected 48 logical cores
Past duration 0.914436 too large
[h264 @ 0x55a59a5b8500] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x55a59a5b8500] nal_unit_type: 8(PPS), nal_ref_idc: 3
Clipping frame in rate conversion by 0.339165
[h264 @ 0x55a59a5b8500] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x55a59a5b8500] Format yuvj420p chosen by get_format().
[h264 @ 0x55a59a5b8500] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0x55a59a5b8500] Frame num gap 6 4
[h264 @ 0x55e256eef5c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x55e256eef5c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x55e256eef5c0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x5649ea893700] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
    Last message repeated 3 times
[rtsp @ 0x5626b5bd85c0] max_analyze_duration 100000 reached at 120000 microseconds st:0
[rtsp @ 0x5626b5bd85c0] decoding for stream 0 failed


    


  • Convert webm to mp3 using python ?

    28 avril 2020, par Andy_ye

    Yes I know that this has been asked many many times, but the libraries on every single answer just ends up needing ffmepg.

    



    The problem with that is that the file size increases dramatically when I include ffmpeg to my project, and I just don't want that.

    



    I want to keep my project as lightweight as possible without needing to add 200 meabytes of data just for video to audio conversion which is just a very small part of the project.

    



    So is there any way to

    



      

      1. 

      2. not use ffmpeg
      3. 


    • 


      1. 

      2. use another lightweight converter with a python wrapper
      3. 


    • 


      1. 

      2. just use the parts in ffmpeg where the webm to mp3 conversion is actually taking place
      3. 


    • 


    


  • Python and ffmpeg audio sync and screen recording issues

    9 août 2020, par odddollar

    I'm using ffmpeg and python to record my desktop screen. When the program is run, it starts recording, then when I press a key-combo it cuts off the last x amount of seconds and saves it then starts recording again ; similar to the "record that" functionality of windows game bar.

    


    I have it working so it records video just fine, but then I change the ffmpeg command to record audio from my desktop and I get an error saying ValueError: could not convert string to float: 'N/A' occurring when I try to calculate the length of the recorded video. It appears as though the recording isn't being stopped until after I try to calculate the video length, even though this exact same code works fine when not recording audio.

    


    Additionally, I also have an issue when recording audio in that the audio is a couple hundred milliseconds in front of the video. It's not a lot but it's enough to be noticeable.

    


    What I'm overall asking, is there a way I can modify the ffmpeg command to prevent the audio desync issues, and what might be causing the problems I'm getting when attempting to find the length of the video with audio ?

    


    import keyboard, signal
from os import remove
from os.path import isfile
from subprocess import Popen, getoutput
from datetime import datetime
import configparser

class Main:
    def __init__(self, save_location, framerate, duration):
        self.save_location = save_location
        self.framerate = int(framerate)
        self.duration = int(duration)
        self.working = self.save_location + '\\' + 'working.avi'
        self.start_recording()

    def start_recording(self):
        if isfile(self.working):
            remove(self.working)

        # start recording to working file at set framerate
        self.process = Popen(f'ffmpeg -thread_queue_size 578 -f gdigrab -video_size 1920x1080 -i desktop -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -b:v 7M -minrate 4M -framerate {self.framerate} {self.working}')
        #self.process = Popen(f'ffmpeg -f gdigrab -framerate {self.framerate} -video_size 1920x1080 -i desktop -b:v 7M -minrate 2M {self.working}')

    def trim_video(self):
        # stop recording working file
        self.process.send_signal(signal.CTRL_C_EVENT)

        # call 'cause I have to
        getoutput(f"ffprobe -i {self.working}")

        # get length of working video
        length = getoutput(f'ffprobe -i {self.working} -show_entries format=duration -v quiet -of csv="p=0"')

        # get time before desired recording time
        start = float(length) - self.duration

        # get save location and title
        title = self.save_location+'\\'+self.get_time()+'.avi'

        # cut to last amount of desired time
        Popen(f"ffmpeg -ss {start} -i {self.working} -c copy -t {self.duration} {title}")
        getoutput(f"ffprobe -i {self.working}")

        self.start_recording()

    def get_time(self):
        now = datetime.now()
        return now.strftime("%Y_%m_%d#%H-%M-%S")


if __name__ == "__main__":
    config = configparser.ConfigParser()
    config.read("settings.ini")
    config = config["DEFAULT"]

    run = Main(config["savelocation"].replace("\\", "\\\\"), config["framerate"], config["recordlast"])
    keyboard.add_hotkey("ctrl+shift+alt+g", lambda:run.trim_video())

    while True:
        try:
            keyboard.wait()
        except KeyboardInterrupt:
            pass


    


    The contents of the settings.ini file are listed below

    


    [DEFAULT]
savelocation = C:\
framerate = 30
recordlast = 10


    


    In the code block, the first line with self.process = Popen is the one that records audio and has the issues, the second line (the commented out one below) is the one that works fine.