Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (63)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

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

Sur d’autres sites (8141)

  • Discord Voice Bot cannot play the audio file

    7 avril 2023, par Jakub Nawrocki

    I tried to write a bot that will join the voice channel and play a audio at 20:00.

    


    Currently the bot joins the channel, but immediately after that it disconnects without making a single sound with this message :

    


    2023-04-07 17:58:01 INFO     discord.player ffmpeg process 18258 has not terminated. Waiting to terminate... 2023-04-07 17:58:01 INFO     discord.player ffmpeg process 18258 should have terminated with a return code of -9. 2023-04-07 17:58:01 INFO     discord.voice_client The voice handshake is being terminated for Channel ID 1093533451778523241 (Guild ID 1093533451778523237) 2023-04-07 17:58:01 INFO     discord.voice_client Disconnecting from voice normally, close code 1000. Audio file loaded:  Audio could not be played:

    


    Code :

    


    import discord
import asyncio
import datetime

TOKEN = 'TOKEN HERE' 
CHANNEL_ID = CHANNEL ID HERE

client = discord.Client(intents=discord.Intents.all())

async def play_sound(voice_client):
    try:
        source = discord.FFmpegPCMAudio('audio.mp3')
        print(f"Audio file loaded: {source}")
        voice_client.play(source)
        while voice_client.is_playing():
            await asyncio.sleep(1)
    except Exception as e:
        print(f"Audio could not be played: {e}")

@client.event
async def on_ready():
    print('Bot is ready')
    now = datetime.datetime.now()
    target_time = datetime.time(hour=20, minute=00)
    if now.time() >= target_time:
        print(f"Current time: {now.time()}. Bot did not join channel.")
        return
    else:
        print(f"Current time: {now.time()}. Bot has joined at {target_time}.")
        await asyncio.sleep((datetime.datetime.combine(datetime.date.today(), target_time) - now).total_seconds())
        channel = client.get_channel(CHANNEL_ID)
        if channel is not None:
            try:
                voice_client = await channel.connect()
                print(f'{client.user} joined voice chat.')
                await asyncio.sleep(1)
                await play_sound(voice_client)
                await voice_client.disconnect()
                print(f'{client.user} left voice chat.')
            except Exception as e:

                print(f"Error during joining channel : {e}")
        else:
            print(f"Did not find a channel of ID {CHANNEL_ID}.")

client.run(TOKEN)


    


    Any ideas ?

    


    ffmpeg has been installed properly.

    


  • ffmpeg's segment_atclocktime cuts at inaccurate times for audio

    3 mai 2023, par Ross Richardson

    I am using ffmpeg's segment format to save files of an AAC stream to disk in hourly segments.
The segmenting works well, but the files are segmented/cut at different times in the clock each hour using segment_atclocktime

    


    I would like each to be exactly on the hour, e.g. 12:00:00, 13:00:00 etc. Or at least, beginning after the hour and not before, e.g. 12:00:00, 13:00:01, 14:00:00 etc.

    


    I am using ffmpeg-python to process the AAC stream and send to two outputs : stdout and these segments.
Here's the code :

    


    out1 = ffmpeg.input(stream, loglevel="panic").output("pipe:",
                                                     format="s16le", 
                                                     acodec="pcm_s16le", 
                                                     ac="1", 
                                                     ar="16000")

out2 = ffmpeg.input(stream, loglevel="info").output("rec/%Y-%m-%d-%H%M%S.aac",
                                                     acodec="copy",
                                                     format="segment",
                                                     segment_time="3600",
                                                     segment_atclocktime="1",
                                                     reset_timestamps="1",
                                                     strftime="1")
            
ffmpeg.merge_outputs(out1, out2)
      .run_async(pipe_stdout=True, overwrite_output=True)


    


    Most files are produced at the desired time : 05:00:00, 06:00:00, 07:00:00, but one or two each day start at 08:59:59 (where 09:00:00 would be desired), or even 16:00:24.

    


    I understand the segment needs to begin on a audio sample so it can't be perfect to the hour, but wondering how I can make it more consistent. Ideally, each hour's recording would begin at 00:00 or later, and not begin before the hour.

    


    I have tried using min_seg_duration 3600, reset_timestamps 1
I am not sure how exactly to use segment_clocktime_wrap_duration for audio, or whether segment_time_delta applies to audio.

    


    I'd appreciate any advice or understanding of how segment_atclocktime works with audio, as much on the internet seems video-focused.

    


  • ffprobe reading wrong frame rate, any workarounds besides MediaInfo ?

    20 mai 2023, par Minty

    I want to check the frame rate of many videos. I decided to employ ffprobe :

    


    ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate faulty.mkv =

    


    500/21


    


    That can't be right, what kind of fps is 500/21 ?

    


    ffprobe faulty.mkv (version 4.3.5-0+deb11u1+rpt3)

    


    Stream #0:0: Video: (...), 23.81 fps, 23.81 tbr, 1k tbn, 23.98 tbc (default)


    


    At least ffprobe 4 read the correct codec timescale i.e. 23.98 tbc (default), but in later versions tbc has been deprecated :

    


    Stream #0:0: Video: (...), 23.81 fps, 23.81 tbr, 1k tbn (default)


    


    However, MediaInfo gets it right :

    


    mediainfo faulty.mkv =

    


    (...)
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
(...)


    


    I tried using -count_packets to then divide nb_read_packets of the stream by the duration of the file, I'm getting 1 second per hour error. This is much better compared to 23,8095, but packets are not frames, and only the prohibitively, unusably slow -count_frames gets me the exact value.

    


    The rest of my workflow uses ffprobe, so I'm reluctant to switch to MediaInfo completely. I get that the file is, well, faulty, but if mediainfo can do it, is there a way to make sure the correct frame rate is read with ffprobe without decoding the entire file as -count_frames seems to do ?