
Recherche avancée
Autres articles (84)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Configurer la prise en compte des langues
15 novembre 2010, parAccé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 (...) -
Le profil des utilisateurs
12 avril 2011, parChaque 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 (9001)
-
Discord music bot doesn't play songs
9 octobre 2023, par Gam3rsCZI have made myself a discord bot that also plays music(it's only for my server so strings with messages are in Czech, but code is in English).
Bot worked a while ago but now it stopped, and I don't know where the problem is


I'm getting these errors : HTTP error 403 Forbidden Server returned 403 Forbidden (access denied) and
C :\Users\Me\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\player.py:711 : RuntimeWarning : coroutine 'music_cog.play_next' was never awaited
self.after(error)
RuntimeWarning : Enable tracemalloc to get the object allocation traceback
[2023-10-09 16:23:47] [INFO ] discord.player : ffmpeg process 17496 successfully terminated with return code of 1.
INFO : ffmpeg process 17496 successfully terminated with return code of 1.


My code is :


import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

class music_cog(commands.Cog):
 def __init__(self, bot):
 self.bot = bot

 self.is_playing = False
 self.is_paused = False
 self.current = ""

 self.music_queue = []
 self.YDL_OPTIONS = {"format": "m4a/bestaudio/best", "noplaylist": "True"}
 self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

 self.vc = None

 def search_yt(self, item):
 with YoutubeDL(self.YDL_OPTIONS) as ydl:
 try:
 info = ydl.extract_info("ytsearch:%s" % item, download=False)["entries"][0]
 except Exception:
 return False
 info = ydl.sanitize_info(info)
 url = info['url']
 title = info['title']
 return {'title': title, 'source': url}

 async def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = True
 self.current = self.music_queue[0][0]["title"]
 m_url = self.music_queue[0][0]["source"]

 self.music_queue.pop(0)

 await self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
 else:
 self.is_playing = False

 async def play_music(self, ctx):
 try:
 if len(self.music_queue) > 0:
 self.is_playing = True
 m_url = self.music_queue[0][0]["source"]

 if self.vc == None or not self.vc.is_connected():
 self.vc = await self.music_queue[0][1].connect()

 if self.vc == None:
 await ctx.send("Nepodařilo se připojit do hlasového kanálu.")
 return
 else:
 await self.vc.move_to(self.music_queue[0][1])

 self.current = self.music_queue[0][0]["title"]
 self.music_queue.pop(0)

 self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
 else:
 self.is_playing = False

 except:
 print("Something went wrong")
 await ctx.send(content="Něco se pokazilo")

 @commands.command(name="play", help="Plays selected song from YouTube")
 async def play(self, ctx, *args):
 query = " ".join(args)

 voice_channel = ctx.author.voice.channel
 if voice_channel is None:
 await ctx.send("Připojte se do hlasového kanálu!")
 elif self.is_paused:
 self.vc.resume()
 else:
 song = self.search_yt(query)
 if type(song) == type(True):
 await ctx.send("Písničku se nepodařilo stáhnout. Špatný formát, možná jste se pokusili zadat playlist nebo livestream.")
 else:
 await ctx.send("Písnička přidána do řady.")
 self.music_queue.append([song, voice_channel])

 if self.is_playing == False:
 await self.play_music(ctx)
 self.is_playing = True

 @commands.command(name="pause", aliases=["p"], help="Pauses the BOT")
 async def pause(self, ctx, *args):
 if self.is_playing:
 self.is_playing = False
 self.is_paused = True
 self.vc.pause()
 await ctx.send(content="Písnička byla pozastavena.")
 
 elif self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()
 await ctx.send(content="Písnička byla obnovena.")

 @commands.command(name="resume", aliases=["r"], help="Resumes playing")
 async def resume(self, ctx, *args):
 if self.is_paused:
 self.is_paused = False
 self.is_playing = True
 self.vc.resume()
 await ctx.send(content="Písnička byla obnovena.")

 @commands.command(name="skip", aliases=["s"], help="Skips current song")
 async def skip(self, ctx, *args):
 if self.vc != None and self.vc:
 self.vc.stop()
 await self.play_next()
 await ctx.send(content="Písnička byla přeskočena.")

 @commands.command(name="queue", aliases=["q"], help="Displays song queue")
 async def queue(self, ctx, songs=5):
 retval = ""

 for i in range(0, len(self.music_queue)):
 if i > songs: break
 retval += " " + self.music_queue[i][0]["title"] + "\n"

 if retval != "":
 retval += "```"
 await ctx.send(content=("```Aktuální fronta:\n" + retval))
 else:
 await ctx.send("Řada je prázdná.")

 @commands.command(name="clear", help="Clears the queue")
 async def clear(self, ctx):
 if self.vc != None and self.is_playing:
 self.vc.stop()
 self.music_queue = []
 await ctx.send("Řada byla vymazána.")

 @commands.command(name="leave", aliases=["dc", "disconnect"], help="Disconnects the BOT")
 async def leave(self, ctx):
 self.is_playing = False
 self.is_paused = False

 if self.vc != None:
 return await self.vc.disconnect(), await ctx.send(content="BOT byl odpojen.")

 else:
 return await ctx.send("BOT není nikde připojen.")
 
 @commands.command(name="current", help="Displays the current song")
 async def current(self, ctx):
 current = self.current
 retval = f"```Právě hraje:\n {current}```"
 if current != "":
 await ctx.send(retval)
 else:
 await ctx.send("Aktuálně nic nehraje.")



I already tried everything I can think of(which isn't a lot because I suck at programming), and also tried searching for some solution on the internet, but nothing worked.


-
Convert mp4/mov/... to mp4 with fluent-ffmpeg
13 octobre 2023, par Sam LeursI have a lambda function which reads a video from s3, converts it with fluent-ffmpeg and streams the video back to (another bucket in) s3.


This is the code so far :


ffmpeg()
 .input(readstream.Body)
 .format('mp4')
 .addOutputOption("-preset veryfast")
 .addOutputOption("-movflags frag_keyframe+empty_moov")
 .addOutputOption("-crf 28")
 .output(writestream, { end: true })
 .on('error', (err, stdout, stderr) => {
 console.log(err);
 console.log('Stdout: %o', stdout);
 console.log('Stderr: %o', stderr);
 })
 .run();



With an input mp4 file, this code works, but with a mov-file it fails. I get the following error :


Error: ffmpeg exited with code 1: Error demuxing input file 0: Invalid data found when processing input
pipe:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
Conversion failed!

 at ChildProcess.<anonymous> (/opt/nodejs/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
 at ChildProcess.emit (node:events:514:28)
 at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2023-10-13T20:10:01.978Z 32c55766-476f-41e9-873a-038341f5630a INFO Stdout: ''
2023-10-13T20:10:01.978Z 32c55766-476f-41e9-873a-038341f5630a INFO Stderr: 'ffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers\n' +
 ' built with gcc 8 (Debian 8.3.0-6)\n' +
 ' configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg\n' +
 ' libavutil 58. 2.100 / 58. 2.100\n' +
 ' libavcodec 60. 3.100 / 60. 3.100\n' +
 ' libavformat 60. 3.100 / 60. 3.100\n' +
 ' libavdevice 60. 1.100 / 60. 1.100\n' +
 ' libavfilter 9. 3.100 / 9. 3.100\n' +
 ' libswscale 7. 1.100 / 7. 1.100\n' +
 ' libswresample 4. 10.100 / 4. 10.100\n' +
 ' libpostproc 57. 1.100 / 57. 1.100\n' +
 '[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5f71b00] stream 0, offset 0x24: partial file\n' +
 '[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5f71b00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 447 kb/s): unspecified pixel format\n' +
 "Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options\n" +
 "Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':\n" +
 ' Metadata:\n' +
 ' major_brand : qt \n' +
 ' minor_version : 512\n' +
 ' compatible_brands: qt \n' +
 ' encoder : Lavf57.19.100\n' +
 ' Duration: 00:00:30.53, start: 0.000000, bitrate: N/A\n' +
 ' Stream #0:0[0x1](eng): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 447 kb/s, 30 fps, 30 tbr, 15360 tbn (default)\n' +
 ' Metadata:\n' +
 ' handler_name : VideoHandler\n' +
 ' vendor_id : FFMP\n' +
 ' encoder : Lavc57.16.101 libx264\n' +
 ' Stream #0:1[0x2](eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 139 kb/s (default)\n' +
 ' Metadata:\n' +
 ' handler_name : SoundHandler\n' +
 ' vendor_id : [0][0][0][0]\n' +
 'Stream mapping:\n' +
 ' Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))\n' +
 ' Stream #0:1 -> #0:1 (aac (native) -> aac (native))\n' +
 '[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5f71b00] stream 0, offset 0x24: partial file\n' +
 'Error demuxing input file 0: Invalid data found when processing input\n' +
 'pipe:0: Invalid data found when processing input\n' +
 'Cannot determine format of input stream 0:0 after EOF\n' +
 'Error marking filters as finished\n' +
 'Conversion failed!\n'
</anonymous>


Is it possible to convert multiple filetypes with one fluent-ffmpeg chain. If not, can someone help me to make a chain for mov ?


-
Cropping a video from Sony A7 Camera using ffmpeg
23 octobre 2023, par Mike SlinnI want to crop a video file created by a Sony A7iii camera, so only the portion from 0:51 through 2:45 is extracted.
The camera adds streams that need to be ignored.


ffprobe
shows the error on input stream 2, however the problem I am reporting deals with input stream 3, which is a data stream, and is not required. I want to exclude input stream 3, then deal with input stream 2.

$ ffprobe myfile.mp4
ffprobe version 3.0-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2016 the FFmpeg developers
 built with gcc 5.3.1 (Debian 5.3.1-8) 20160205
 configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
 libavutil 55. 17.103 / 55. 17.103
 libavcodec 57. 24.102 / 57. 24.102
 libavformat 57. 25.100 / 57. 25.100
 libavdevice 57. 0.101 / 57. 0.101
 libavfilter 6. 31.100 / 6. 31.100
 libswscale 4. 0.100 / 4. 0.100
 libswresample 2. 0.101 / 2. 0.101
 libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
 Metadata:
 major_brand : XAVC
 minor_version : 16785407
 compatible_brands: XAVCmp42iso2
 creation_time : 2023-01-05 00:52:24
 Duration: 00:10:58.16, start: 0.000000, bitrate: 51445 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4), 1920x1080 [SAR 1:1 DAR 16:9], 49370 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
 Metadata:
 creation_time : 2023-01-05 00:52:24
 handler_name : Video Media Handler
 encoder : AVC Coding
 Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
 Metadata:
 creation_time : 2023-01-05 00:52:24
 handler_name : Sound Media Handler
 Stream #0:2(und): Data: none (rtmd / 0x646D7472), 491 kb/s (default)
 Metadata:
 creation_time : 2023-01-05 00:52:24
 handler_name : Timed Metadata Media Handler
Unsupported codec with id 0 for input stream 2



Predictably,
ffmpeg
fails becauseffprobe
failed.

$ ffmpeg -y -i 'myfile.mp4' -ss 51 -to 2:45 -acodec copy 'myfile.crop.mp4'
ffmpeg version 5.1.2-3ubuntu1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
 configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55d61a97fc80] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55d61a97fc80] st: 0 edit list 1 Cannot find an index entry before timestamp: 1001.
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
 Metadata:
 major_brand : XAVC
 minor_version : 16785407
 compatible_brands: XAVCmp42iso2
 creation_time : 2023-01-05T00:52:24.000000Z
 Duration: 00:10:58.16, start: 0.000000, bitrate: 51445 kb/s
 Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 49370 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
 Metadata:
 creation_time : 2023-01-05T00:52:24.000000Z
 handler_name : Video Media Handler
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 Stream #0:1[0x2](und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
 Metadata:
 creation_time : 2023-01-05T00:52:24.000000Z
 handler_name : Sound Media Handler
 vendor_id : [0][0][0][0]
 Stream #0:2[0x3](und): Data: none (rtmd / 0x646D7472), 491 kb/s (default)
 Metadata:
 creation_time : 2023-01-05T00:52:24.000000Z
 handler_name : Timed Metadata Media Handler
 timecode : 03:52:30:26
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55d61aa58a80] using SAR=1/1
[libx264 @ 0x55d61aa58a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d61aa58a80] profile High, level 4.2, 4:2:0, 8-bit
[libx264 @ 0x55d61aa58a80] 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=34 lookahead_threads=5 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
[mp4 @ 0x55d61aa57cc0] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!



I tried various incantations that specified permutations of
-map
options, but only dug myself a deeper hole.

How might I perform the extraction ? I am not interested in preserving extra streams, I just want the main video and stereo audio streams.