Recherche avancée

Médias (2)

Mot : - Tags -/kml

Autres articles (101)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (11885)

  • Using ffmpeg to record screen returns corrupted file

    8 août 2020, par odddollar

    I'm using ffmpeg and python to record my desktop screen. I've got it working so that when I input a shortcut, it starts recording. Then I use .terminate() on the subprocess to stop recording. When outputting to an mp4, this corrupts the file and makes it unreadable. I can output the file as an flv or avi and it doesn't get corrupted, but then the video doesn't contain time/duration data, something I need.

    


    Is there a way I can gracefully stop the recording when outputting an mp4 ?
Or is there a way I can include the time/duration data in the flv/avi ?

    


    import keyboard
import os
from subprocess import Popen

class Main:
    def __init__(self):
        self.on = False

    def main(self):
        if not self.on:
            if os.path.isfile("output.mp4"):
                os.remove("output.mp4")

            self.process = Popen('ffmpeg -f gdigrab -framerate 30 -video_size 1920x1080 -i desktop -b:v 5M output.mp4')
            self.on = True
        else:
            self.process.terminate()

            self.on = False

run = Main()
keyboard.add_hotkey("ctrl+shift+g", lambda:run.main())

keyboard.wait()


    


  • FFMpeg returns error : Unrecognized option 'master_pl_name'

    14 février 2021, par jonatasos

    I used this command (described at the processing message bellow) on my application several times before and always worked well. Now returns that error.

    


    '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' 
'/home/vagrant/code/myapp/storage/videos/videos_disk/a3.mp4' '-map' '0' '-vcodec' 'libx264' 
'-b:v' '500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_0_500_%05d.ts' '-master_pl_name' 
'master_playlist_guide_0.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_0_500.m3u8' '-map' '0' '-vcodec' 
'libx264' '-b:v' '1500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_1_1500_%05d.ts' '-master_pl_name' 
'master_playlist_guide_1.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_1_1500.m3u8' '-map' '0' '-vcodec' 
'libx264' '-b:v' '3000k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' 
'/home/vagrant/code/myapp/storage/app/public/test_2_3000_%05d.ts' '-master_pl_name' 
'master_playlist_guide_2.m3u8' '-acodec' 'aac' '-b:a' '128k' 
'/home/vagrant/code/myapp/storage/app/public/test_2_3000.m3u8'


    


    (single line:) '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' '/home/vagrant/code/myapp/storage/videos/videos_disk/a3.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_0_500_%05d.ts' '-master_pl_name' 'master_playlist_guide_0.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_0_500.m3u8' '-map' '0' '-vcodec' 'libx264' '-b:v' '1500k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_1_1500_%05d.ts' '-master_pl_name' 'master_playlist_guide_1.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_1_1500.m3u8' '-map' '0' '-vcodec' 'libx264' '-b:v' '3000k' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/home/vagrant/code/myapp/storage/app/public/test_2_3000_%05d.ts' '-master_pl_name' 'master_playlist_guide_2.m3u8' '-acodec' 'aac' '-b:a' '128k' '/home/vagrant/code/myapp/storage/app/public/test_2_3000.m3u8':



    


    This is the error returned :

    


     ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Unrecognized option 'master_pl_name'.
Error splitting the argument list: Option not found


    


    I`ve reinstalled the ffmpeg, also tested in a virtual machine and the same error happens.

    


    Live server : CentOS 7 / Apache2 / PHP-fpm 7.3 ;
Virtual machine : Ubuntu 20.04 / nginx / PHP-fpm 7.4.5

    


    I really have no clue about what to do about it now.

    


  • Discord bot returns ffmpeg error despite being added to PATH

    22 février 2024, par Sam

    I am creating a Discord bot to play music via Youtube as practice with APIs. Every time I run the command to play a Youtube video I am met with "ffmpeg was not found". I have downloaded ffmpeg (as I'm on Windows) and moved the folder to my C : drive. Once done, I've added it to the path within environment variables. The error persists.

    


      

    • I've added ffmpeg to my PATH as described in this video.
    • 


    • Additionally, I've found forums where the suggested answer is to add ffmpeg to your PATH.
    • 


    


    In command prompt, if I type "ffmpeg" it returns "'FFmpeg' is not recognized as an internal or external command, operable program or batch file."

    


    Here is my code :

    


    from typing import Final
import os
from dotenv import load_dotenv
from discord import Intents, Client, Message
from responses import get_response
import asyncio
import yt_dlp
import discord

#Step 0: Load our token from somewhere safe
load_dotenv()
#Final decorator makes it so that this cannot be overwritten or have subclasses
TOKEN: Final[str] = os.getenv('DISCORD_TOKEN')


voice_clients = {}
#Settings for the video download.
yt_dl_opts = {'format': 'bestaudio/best'}
ytdl = yt_dlp.YoutubeDL(yt_dl_opts)

#Settings for ffmpeg. 
ffmpeg_options = {'options': '-vn'}

# Step 1: Bot Setup - activate intents
intents: Intents = Intents.default()
intents.message_content = True #NOQA
client: Client = Client(intents=intents)

#Step 2: Message Functionality
async def send_message(message: Message, user_message: str):
    if not user_message:
        print('Message was empty because intents were not enabled... probably')
        return
    
    # The := "Walrus Operator" is used to prompt for input.
    if is_private := user_message[0] == '?':
        user_message = user_message[1:]
    
    try:
        response: str = get_response(user_message)
        await message.author.send(response) if is_private else await message.channel.send(response)
    except Exception as e:
        print(e)

#Step 3: Handling the startup for our bot.
        
@client.event
async def on_ready() -> None:
    print(f"{client.user} is now running")

#Step 4: Handle incoming messages
@client.event
async def on_message(message: Message) -> None:
    if message.author == client.user:
        return
    
    username: str = str(message.author)
    user_message: str = message.content
    channel: str = str(message.channel)

    print(f"[{channel}] {username}: '{user_message}")
    await send_message(message, user_message)

    if message.content.startswith("!play"):
        try:
            url = message.content.split()[1]
            
            #Handles the voice connection that a bot has to a certain channel
            voice_client = await message.author.voice.channel.connect()
            voice_clients[voice_client.guild.id] = voice_client

            loop = asyncio.get_event_loop()
            data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))

            song = data['url']
            player = discord.FFmpegPCMAudio(song, **ffmpeg_options)

            voice_client.play(player)



        except Exception as err:
            print(err)

# Step 5: Main entry point
def main() -> None:
    client.run(token=TOKEN)

if __name__ == '__main__':
    main()```