Recherche avancée

Médias (0)

Mot : - Tags -/objet éditorial

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (69)

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

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (6654)

  • Need help to create a queue system with a discord.py bot

    19 août 2024, par Zamv

    im trying to create a bot with discord.py, i'll start saying that the bot is for personal use so please don't point out that i shouldn't use ydl in the comments, ty :
Also, im a beginner, so please tell me what I can improve and any errors there are, I will be happy to listen.
That said, i've been stuck on trying to create this queue system for songs for the past 3 days, the bot was working perfectly fine and played some urls before i implemented the play_next function, now it doesn't even play the first song, even if it sends confirmation messages both in the terminal that in the discord channel, i know that the code might be a little confusing, but please i really need to know how to make this work

    


    i wrote two main functions : "play_next" to play the next song in the queue and "play", the main command.
Here is my play_next function :

    


    async def play_next(self,ctx):
        if not ctx.voice_client.is_playing: #(don't know if this is correct as I also check if the bot isn't                     playing anything in the play function)
            
            if self.song.queue: 
                next_song = self.song_queue.pop(0) #deleting the first element of the queue, so if we have (song_0, song_1 and song_2) the bot should delete (song_0) making in fact song_1 the "next" song_0
                try:
                    ctx.voice_client.play(discord.FFmpegPCMAudio(next_song), 
                                          after=lambda e: self.bot.loop.create_task(self.play_next(ctx))) #Not gonna lie here, i asked chat gpt for this line, it should make the bot automatically play the next song one after another, correct me if I am wrong

#this is not important
                    embed = discord.Embed(
                        title="Song",
                        description=f"Now playing {next_song}",
                        color = 0x1DB954
                    )
                    await ctx.send(embed=embed)
                except Exception as e:
                    print(f"Error playing the next song: {e}")

            else:
                await ctx.voice_client.disconnect()  # disconnecting from the voice channel if the queue is empty
                print("Disconnected from the voice channel as the queue is empty.")


    


    I think that the main problem of my bot is the play_next function, but here it is my "play" function :

    


        @commands.command(pass_context=True)
    async def play(self, ctx, url: str):  
        if ctx.author.voice:  # first checking if the user is in a voice channel
            if not ctx.voice_client: #then checking if the bot is already connected to a voice channel
                channel = ctx.message.author.voice.channel 
                try:
                    await channel.connect()  #then joining
                    print("I joined the voice channel!")
                except Exception as e:
                    print(f"Failed to connect to the voice channel: {e}")
                    return

            song_path = f"song_{self.song_index}.mp3" #note, im using cogs, i declared self.song_index with the value of 0 
            self.song_index += 1 #i thought that this was the easiest way of creating a new file for each song

            ydl_opts = {
                'format': 'bestaudio/best',
                'postprocesors': [{
                    'key': 'FFmpegExtractAudio',
                    'preferredcodec': 'mp3',
                    'preferredquality': '192',
                }],
                'outtmpl': song_path
            }
            try:
                with youtube_dl.YoutubeDL(ydl_opts) as ydl:
                    print("Starting download...")
                    ydl.download([url]) #this is where it should download the song provided by the url
                    print("Download finished.")
            except Exception as e:
                await ctx.send(f"Failed to download the song: {e}")
                return

#i think that the next two if statements are the main threats
            if os.path.exists(song_path): #if there is atleast 1 song in the queue
                self.song_queue.append(song_path) #append the next one
                embed = discord.Embed(
                    title="Added to Queue!",
                    description = f"{url} has been added to the queue.",
                    color=0x33ff33
                )
                await ctx.send(embed=embed)


                if not ctx.voice_client.is_playing(): #checking if the bot is already playing something, don't know if i should put this if statement here
                    print("Starting playback...")
                    await self.play_next(ctx) #if nothing is playing, then the bot should play the next song



            else:
                await ctx.send("Failed to download or find the audio file.")

        else:
            embed = discord.Embed(
                title="❌You must be in a voice channel",
                color=0xff6666
            )
            await ctx.send(embed=embed)


    


    thanks in advance, i will try to read and answer any questions as soon as possible

    


  • ffmpeg error "Could not write header for output file #0 (incorrect codec parameters ?) : Operation not permitted Error initializing output stream 0:0"

    27 juillet 2022, par DevSharma

    I am running FFmpeg in my app and specifically in "Android 11" I am getting this error from several users

    


    I have researched a lot but no solution found.

    


    I thought there is something wrong with the codec parameter that is being passed since it is saying "incorrect codec parameters" but most of the parameters looks good.

    


    also verified if all the required file permission are granted and those are good too

    


    now I m unable to find the problem,

    


    please help, thanks

    


    Command:&#xA;/data/app/~~hyrHVcslcfdQcguX0rauRA==/<apppackage>-QbDCul7FXU4tVniSDeP1Sg==/lib/arm64/libffmpeg.so -i /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Video/VID-20220414-WA0010.mp4 -c:v libx264 -crf 23 -map 0:V -map 0:a? -map 0:s? -c:s mov_text -segment_time 26 -g 26 -sc_threshold 0 -force_key_frames expr:gte(t,n_forced*26) -reset_timestamps 1 -f segment -preset ultrafast /storage/emulated/0/Movies/splitVideoFolder/split_video%03d.mp4&#xA;&#xA;Error:&#xA;ffmpeg version v4.4-dev-416 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)&#xA;  configuration: --cross-prefix=aarch64-linux-android- --sysroot=/Users/admin/AndroidStudioProjects/android-ndk-r21d/toolchains/llvm/prebuilt/darwin-x86_64/sysroot --prefix=/Users/admin/AndroidStudioProjects/Tanner/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/local/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android21-clang --cxx=aarch64-linux-android21-clang&#x2B;&#x2B; --extra-libs=&#x27;-L/Users/admin/AndroidStudioProjects/Tanner/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat&#x27; --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --disable-shared --disable-ffplay --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libass --enable-iconv --enable-libx264 --enable-gpl --disable-sdl2 --enable-zlib --enable-mediacodec&#xA;  libavutil      56. 55.100 / 56. 55.100&#xA;  libavcodec     58. 96.100 / 58. 96.100&#xA;  libavformat    58. 48.100 / 58. 48.100&#xA;  libavdevice    58. 11.101 / 58. 11.101&#xA;  libavfilter     7. 87.100 /  7. 87.100&#xA;  libswscale      5.  8.100 /  5.  8.100&#xA;  libswresample   3.  8.100 /  3.  8.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Video/VID-20220414-WA0010.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42isom&#xA;  Duration: 00:01:30.53, start: 0.000000, bitrate: 671 kb/s&#xA;    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 576x1024 [SAR 1:1 DAR 9:16], 539 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)&#xA;    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (aac (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 0xb400007727c64800] using SAR=1/1&#xA;[libx264 @ 0xb400007727c64800] using cpu capabilities: ARMv8 NEON&#xA;[libx264 @ 0xb400007727c64800] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit&#xA;[libx264 @ 0xb400007727c64800] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=26 keyint_min=2 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0&#xA;[segment @ 0xb400007727c28800] Opening &#x27;/storage/emulated/0/Movies/splitVideoFolder/split_video000.mp4&#x27; for writing&#xA;[segment @ 0xb400007727c28800] Failed to open segment &#x27;/storage/emulated/0/Movies/splitVideoFolder/split_video000.mp4&#x27;&#xA;Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted&#xA;Error initializing output stream 0:0 --&#xA;[aac @ 0xb400007727c65700] Qavg: 18220.703&#xA;[aac @ 0xb400007727c65700] 2 frames left in the queue on closing&#xA;Conversion failed!&#xA;</apppackage>

    &#xA;

  • Using ffmpeg to read mp4 file from stdin and extract image is failing with "Invalid data found when processing input"

    16 mars 2023, par jsindos

    Using ffmpeg, I'm trying to read an mp4 file from stdin, and save the last frame of the file to jpg.

    &#xA;

    cat PXL_20221118_051057924.TS.mp4 | ffmpeg -sseof -3 -i - -f mp4 -update 1 -q:v 1 last.jpg&#xA;

    &#xA;

    The command works fine when not running from stdin.

    &#xA;

    When running from stdin, an empty file is created, with the following error message :

    &#xA;

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fcb4d0041c0] stream 1, offset 0x2eaee0d: partial file&#xA;pipe:: Invalid data found when processing input&#xA;

    &#xA;

    I've posted the full output below.

    &#xA;

    &#xA;

    ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with Apple clang version 14.0.0 (clang-1400.0.29.202)&#xA;  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2_5 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fcb4d0041c0] stream 2, offset 0x2c: partial file&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;pipe:&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 131072&#xA;    compatible_brands: isomiso2mp41&#xA;    creation_time   : 2022-11-18T05:11:23.000000Z&#xA;    com.android.capture.fps: 30.000000&#xA;  Duration: 00:00:23.74, start: 0.000000, bitrate: N/A&#xA;  Stream #0:0[0x1](eng): Data: none (mett / 0x7474656D), 45 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : MetaHandle&#xA;  Stream #0:1[0x2](eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : SoundHandle&#xA;      vendor_id       : [0][0][0][0]&#xA;  Stream #0:2[0x3](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 1920x1080, 19524 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : VideoHandle&#xA;      vendor_id       : [0][0][0][0]&#xA;    Side data:&#xA;      displaymatrix: rotation of -90.00 degrees&#xA;  Stream #0:3[0x4](eng): Data: none (mett / 0x7474656D) (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : MetaHandle&#xA;Stream mapping:&#xA;  Stream #0:2 -> #0:0 (hevc (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (aac (native) -> aac (native))&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fcb4d0041c0] stream 1, offset 0x2eaee0d: partial file&#xA;pipe:: Invalid data found when processing input&#xA;[libx264 @ 0x7fcb4d10b500] -qscale is ignored, -crf is recommended.&#xA;[libx264 @ 0x7fcb4d10b500] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0x7fcb4d10b500] profile High, level 4.0, 4:2:0, 8-bit&#xA;[libx264 @ 0x7fcb4d10b500] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, mp4, to &#x27;/Users/josephtsindos/Downloads/last2.jpg&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 131072&#xA;    compatible_brands: isomiso2mp41&#xA;    com.android.capture.fps: 30.000000&#xA;    encoder         : Lavf59.27.100&#xA;  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p(pc), 1080x1920, q=2-31, 30 fps, 15360 tbn (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : VideoHandle&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc59.37.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;      displaymatrix: rotation of -0.00 degrees&#xA;  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2022-11-18T05:11:23.000000Z&#xA;      handler_name    : SoundHandle&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc59.37.100 aac&#xA;frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    &#xA;video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;[aac @ 0x7fcb4d10c840] Qavg: nan&#xA;

    &#xA;