Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (58)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les 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 : (...)

Sur d’autres sites (10304)

  • How do you make a modern bleep censor ?

    2 août 2023, par nick carraway

    I have always been a fan of live caller radio shows. These (sports) shows allow callers to call a hotline and talk to the radio host directly.

    


    One of the oldest problems with this show format is what if the caller curses, or says something highly inappropriate ? To keep the show clean (and legal), the radio shows broadcast with a 7 second delay. They also use a "bleep" censor, which historically allowed them to wipe the incriminating phrase with a "Beeeeeep" sound. These days, however, they completely cut out the caller's sentence before it even begins. ("Ah, we had to let you go there pal. Can't say that on the radio"). In the modern method, the transition is seamless, almost like they shorten the 7 second delay to a 4 second delay as they remove the start of the caller's reply entirely, and overwrite it with the host's explanations. The caller does not appear to be "interrupted" at all, the start of their sentence leading to the bad phrase is never even broadcasted.

    


    I've been thinking about how to do this in software. I found a project that looked promising. It adds a 7 second delay to your streams, and allows you to convert X amount of those seconds into silence assuming a caller says something inappropriate. While not ideal (since it's a few seconds of dead silence and would interrupt the caller mid-sentence), how can you do something like this in ffmpeg ? It is a good starting point before implementing the more modern features.

    


      

    1. How do you use ffmpeg to livestream a video/audio stream with a delay ?
    2. 


    3. How do you overwrite the last 3 seconds of that stream with silence or a "bleep", when you need to ?
    4. 


    5. Are you able to easily switch your stream to overwrite those 3 seconds with new audio (e.g. the host's explanation for why the caller was hung-up on) ? And how can you go back from a 4 second delay to a 7 second delay ?
    6. 


    


    OR, is there a ready-made software to get flawless "radio-like" hang-ups on bad callers ?

    


  • FileNotFoundError running ffmpeg on Windows from Python subprocess

    4 avril 2023, par mahmoudamintaha

    this is my code to convert mkv to mp4
i created both assets and results folders
i added ffmpeg to user and enviroment variables path

    


    import os
import subprocess

if not os.path.exists("assets"):
    raise Exception("Please create and put all MKV files in assets folder. ")

mkv_list = os.listdir("assets")

if not os.path.exists("results"):
    os.mkdir("results")

for mkv in mkv_list:
    name, ext = os.path.splitext(mkv)
    if ext != ".mkv":
        raise Exception("Please add MKV files only!")

    output_name = name + ".mp4"

    try:
        subprocess.run(
            ['ffmpeg', '-i', f"assets/{mkv}", "-codec", "copy", f"results/{output_name}"], check=True
        )

    except:
        raise Exception(
            "Please, download, install and Add the path FFMPEG to Enviroment variables ")

print(f"{len(mkv_list)} video/s have ben converted")
os.startfile("results")


    


    i get this error messages when i run it

    


    ---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[1], line 20
     19 try:
---> 20     subprocess.run(
     21         ['ffmpeg', '-i', f"assets/{mkv}", "-codec", "copy", f"results/{output_name}"], check=True
     22     )
     24 except:

File c:\Users\HP\anaconda3\envs\Projectvenv\Lib\subprocess.py:546, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    544     kwargs['stderr'] = PIPE
--> 546 with Popen(*popenargs, **kwargs) as process:
    547     try:

File c:\Users\HP\anaconda3\envs\Projectvenv\Lib\subprocess.py:1022, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
   1019             self.stderr = io.TextIOWrapper(self.stderr,
   1020                     encoding=encoding, errors=errors)
-> 1022     self._execute_child(args, executable, preexec_fn, close_fds,
   1023                         pass_fds, cwd, env,
   1024                         startupinfo, creationflags, shell,
   1025                         p2cread, p2cwrite,
   1026                         c2pread, c2pwrite,
   1027                         errread, errwrite,
   1028                         restore_signals,
   1029                         gid, gids, uid, umask,
   1030                         start_new_session, process_group)
   1031 except:
   1032     # Cleanup if the child failed starting.

File c:\Users\HP\anaconda3\envs\Projectvenv\Lib\subprocess.py:1491, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session, unused_process_group)
   1490 try:
-> 1491     hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1492                              # no special security
   1493                              None, None,
   1494                              int(not close_fds),
   1495                              creationflags,
   1496                              env,
   1497                              cwd,
   1498                              startupinfo)
   1499 finally:
   1500     # Child is launched. Close the parent's copy of those pipe
   1501     # handles that only the child should have open.  You need
   (...)
   1504     # pipe will not close when the child process exits and the
   1505     # ReadFile will hang.

FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
Cell In[1], line 25
     20         subprocess.run(
     21             ['ffmpeg', '-i', f"assets/{mkv}", "-codec", "copy", f"results/{output_name}"], check=True
     22         )
     24     except:
---> 25         raise Exception(
     26             "Please, download, install and Add the path FFMPEG to Enviroment variables ")
     28 print(f"{len(mkv_list)} video/s have ben converted")
     29 os.startfile("results")

Exception: Please, download, install and Add the path FFMPEG to Enviroment variables 


    


    I checked adding ffmpeg to environment variable and it's added
I used jupyter to know the specific line the doesn't work and it's the subprocess line

    


  • Getting bytes output with ffmpeg and subprocess

    23 septembre 2023, par Federico Perez Diduch

    I'm downloading some images from a website and making a video out of it. I don't want to save the video to a file and then read it so I can send it through a POST request. I'm looking to unify this process and Download > Make video > Get output bytes > POST.

    


    def convert_images_to_video():
    #output_video = "output.mp4"

    data = get_radar_images("a")
    if not data:
        return False
    
    ffmpeg_cmd = [
        "ffmpeg",
        "-framerate",
        "2",  # Input frame rate (adjust as needed)
        "-f",
        "image2pipe",
        "-vcodec",
        "png",
        "-i",
        "-",  # Input from pipe
        "-vf",  # Video filter
        "fps=30",  # Output frame rate (adjust as needed)
        "-c:v",
        "libx264",  # Video codec (h.264)
        "-vf",  # Additional video filters
        "pad=ceil(iw/2)*2:ceil(ih/2)*2",  # Padding and resolution adjustment
        "-profile:v",
        "high",  # H.264 profile
        "-level",
        "3.0",  # H.264 level
        "-pix_fmt",
        "yuv420p",  # Pixel format
        "-brand",
        "mp42",
        "-movflags",
        "frag_keyframe",  # Branding
        "-f",
        "mp4",
        "-",
    ]


    ffmpeg_process = subprocess.Popen(
        ffmpeg_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    radar_images = data.get("list")[::-1]

    for image in radar_images:
        img_url = f"https://mycoolweb.com/coolimages/{image}"
        content = requests.get(img_url).content
        ffmpeg_process.stdin.write(content)

    ffmpeg_process.stdin.close()
    ffmpeg_process.terminate()

    ffmpeg_process.wait()
    video_bytes = ffmpeg_process.stdout.read()

    print(video_bytes)


    


    By doing this and executing python app.py makes the process hang in there without any output at all. I tried adding universal_newlines=True to the subprocess.Popen but that return a TypeError: write() argument must be str, not bytes exception.

    


    Since I'm working with images it does not work to image.decode("utf-8"). I been trying for a while and reading ffmpeg docs on pipes but cant get it to work.