Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (53)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP 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, par

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le 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 (7064)

  • FileNotFoundError when extracting audio from recently saved video using FFMPEG"

    3 août 2023, par Peter Long

    Scenario : I'm using this tool to record tiktok live. I write another script to call the main.pytool because I want to add some additional options, for example, to extract the audio of the live video that is recorded

    


    FFMPEG is used to extract the audio. First the video is saved (with FFMPEG) and after I want to extract the audio of that video (again with FFMPEG). The path where the video is recorded and saved is C:\Users\Administrator\Desktop\tiktok

    


    The problem is that I see the file and it is saved, but this error is generated as output : FileNotFoundError: [WinError 2] The system cannot find the file specified

    


    I can't figure out why it doesn't detect the last saved video file in general

    


    I try with this

    


    import os
import subprocess
import time
from moviepy.editor import VideoFileClip

def main():
    # Command to run main.py and record the video
    cmd = 'python main.py -user ryzebenny -output "C:\\Users\\Administrator\\Desktop\\tiktok" -ffmpeg -duration 30 --auto-convert'
    subprocess.run(cmd, shell=True)

    # Wait for the video file to appear in the folder
    wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")

    # Extract audio from recorded video
    video_filename = find_latest_file("C:\\Users\\Administrator\\Desktop\\tiktok", ".mp4")
    if video_filename:
        video_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", video_filename)
        audio_filename = video_filename.replace(".mp4", ".mp3")
        audio_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", audio_filename)

        video_clip = VideoFileClip(video_path)
        audio_clip = video_clip.audio
        audio_clip.write_audiofile(audio_path)
        audio_clip.close()
        video_clip.close()
        print(f"Audio extraction completed: {audio_filename}")
    else:
        print("No video files found.")

def wait_for_video(directory):
    max_wait_time = 60  # Maximum time to wait in seconds
    start_time = time.time()
    while time.time() - start_time < max_wait_time:
        if find_latest_file(directory, ".mp4"):
            break
        time.sleep(1)

def find_latest_file(directory, extension):
    list_of_files = [f for f in os.listdir(directory) if f.endswith(extension) and os.path.isfile(os.path.join(directory, f))]
    if list_of_files:
        return max(list_of_files, key=os.path.getctime)
    return None

if __name__ == "__main__":
    main()


    


    but i get this error

    


    [*] 2023-08-03 15:57:09 - INFO - START RECORDING FOR 30 SECONDS&#xA;[*] 2023-08-03 15:57:09 - INFO - [PRESS &#x27;q&#x27; TO STOP RECORDING]&#xA;[*] 2023-08-03 15:57:31 - INFO - FINISH: C:\Users\Administrator\Desktop\tiktok\TK_ryzebenny_2023.08.03_15-57-09_flv.mp4&#xA;&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 45, in <module>&#xA;    main()&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 12, in main&#xA;    wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 34, in wait_for_video&#xA;    if find_latest_file(directory, ".mp4"):&#xA;       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 41, in find_latest_file&#xA;    return max(list_of_files, key=os.path.getctime)&#xA;           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "<frozen genericpath="genericpath">", line 65, in getctime&#xA;FileNotFoundError: [WinError 2] The system cannot find the file specified: &#x27;TK_ryzebenny_2023.08.03_15-57-09.mp4&#x27;&#xA;</frozen></module>

    &#xA;

    Instead, I expect that once I save the video (in .mp4) the audio of that video will be extracted afterwards

    &#xA;

  • Parse dynamic mpd file with Media Source Extensions

    17 février 2023, par FrankC

    I just started learning about adaptive streaming, and currently I'm working on a project that needs showing a live video. In order to control some of the elements in mpd file, I determined to use MSE instead of dash.js. I refer to the code at the following URL :https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/samples/dn551368(v=vs.85)&#xA;But I found out that there is no "Initialization" tag or "range" attribute in my mpd file. I don't find any relative attribute as well. By the way I'm use nginx-rtmp + ffmpeg to generate dash file.&#xA;So here is my dash file looks like

    &#xA;

    &lt;?xml version="1.0"?>&#xA; &#xA;  <period start="PT0S">&#xA;    &#xA;      &#xA;        &#xA;          <segmenttimeline>&#xA;             <s t="0" d="10000"></s>&#xA;             <s t="10000" d="10000"></s>&#xA;             <s t="20000" d="5000"></s>&#xA;             <s t="25000" d="10000"></s>&#xA;          </segmenttimeline>&#xA;        &#xA;      &#xA;    &#xA;  </period>&#xA;&#xA;

    &#xA;

    My question is :&#xA;1.Did I have any missing parameters in using ffmpeg or nginx-rtmp resulting in losting tag in mpd file ?&#xA;2.Or there is other way to setup "Initialization"/"range" attribute and let my program work ?&#xA;3.I also curious about why my mpd file doesn't have a baseURL element ?

    &#xA;

    ※My mpd file works fine with dash.js, I can see the video properly

    &#xA;

    THANKS A LOT

    &#xA;

  • Why is the ffmpeg process in discordpy terminating without playing anything ?

    18 janvier 2024, par Bummbumm6

    I'm making a discord bot for playing music (ik very unoriginal) and everytime I try to play music, it gives this error :

    &#xA;

    2023-02-18 12:31:54 INFO     discord.player ffmpeg process 4024 has not terminated. Waiting to terminate...&#xA;2023-02-18 12:31:54 INFO     discord.player ffmpeg process 4024 should have terminated with a return code of -9.&#xA;

    &#xA;

    It is in the voice chat and didn't play anything. Here's my code if you need it :

    &#xA;

    print("defining functions")&#xA;import discord, pytube, os, threading&#xA;from moviepy import editor&#xA;from discord.ext.commands import Bot&#xA;intents=discord.Intents.default()&#xA;intents.message_content = True&#xA;intents.voice_states = True&#xA;bot = Bot("b!",intents=intents)&#xA;check = False&#xA;token = "redacted"&#xA;@bot.command()&#xA;async def play(ctx, arg):&#xA;            await ctx.send("Downloading...")&#xA;            try:&#xA;                yt = pytube.YouTube(arg)&#xA;                print("STREAM: "&#x2B;str(yt.streams.filter(only_audio=True,mime_type="audio/webm",type="audio",abr="160kbps")))&#xA;                def download(yt):&#xA;                    print("DOWNLOADING STREAM TO AUDIO.WEBM")&#xA;                    yt.streams.filter(only_audio=True,mime_type="audio/webm",type="audio",abr="160kbps").order_by("abr").first().download(filename="audio.webm")&#xA;                    print("EXPORTING TO MP3")&#xA;                    editor.AudioFileClip("audio.webm").write_audiofile("audio.webm"[:-5] &#x2B; ".mp3")&#xA;                    os.remove("audio.webm")&#xA;                    print("DONE")&#xA;                thread = threading.Thread(target=download, args=(yt,))&#xA;                thread.start()&#xA;                thread.join()&#xA;                try:&#xA;                  channel = ctx.author.voice.channel&#xA;                  try:&#xA;                    vc = await channel.connect()&#xA;                  except Exception:&#xA;                    ctx.send("already in vc, one sec")&#xA;                except Exception:&#xA;                    pass&#xA;                vc.play(discord.FFmpegPCMAudio(source="audio.mp3", executable="./ffmpeg"))&#xA;            except Exception:&#xA;              pass&#xA;bot.run(token)&#xA;&#xA;

    &#xA;

    It worked on my computer in VS Code, but I wanted to test it on Replit and only there I got the error. I tried :

    &#xA;

      &#xA;
    1. Reinstalling discord, pynacl, even pytube and moviepy.
    2. &#xA;

    3. Using a local copy of ffmpeg on replit, see line 36.
    4. &#xA;

    5. Adding the intents that were described in a different thread.
    6. &#xA;

    &#xA;

    One thing that always happens is the exit code being -9 but the process number changing (ofc). I saw a GitHub Issue about this too which is not showing a fix so how do I fix that ?

    &#xA;