
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (52)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (8161)
-
Discord FFMPEG audio wont play from yt-dlp
19 mars 2023, par user21236822My question is this : Why isn't my bot playing audio ?


I want the bot to join, play audio from queue, then disconnect without downloading an mp3 file.


I tried using youtube-dl, but I switched to the yt-dlp library after getting errors I couldn't fix.
I am running on Windows 10 locally. All my libraries are up to date.


Here are my ydl_opts and FFMPEG_OPTS :


ydl_opts = {
 'format': 'bestaudio/best',
 'postprocessors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }],
}

FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
 'options': '-vn'
} 



Here is where I believe the problem is.


async def play():
 print("Play Called")
 musicPlay()
 # Get message object from initial request
 message = ytLinkQue.get()
 print(f"Message object recieved: {message}")
 voiceChannel = message.author.voice.channel
 vc = await voiceChannel.connect()
 songsPlayed = 0
 
 while not ytLinkQue.empty():
 # Get current song
 currentSong = ytLinkQue.get()[0]
 print(f"Current song: {currentSong}")

 # Get song from Youtube
 with yt_dlp.YoutubeDL(ydl_opts) as ydl:
 # song = ydl.download(currentSong)
 info = ydl.extract_info(currentSong, download=False)
 song = info['formats'][0]['url']

 # Play Song
 vc.play(discord.FFmpegPCMAudio(song, **FFMPEG_OPTIONS), after=lambda e: print('Song done'))

 # Wait until the song has finished playing
 while vc.is_playing():
 print("playing rn")
 await asyncio.sleep(1)
 
 await vc.disconnect()
 musicStop()



When play() is called, here is the output in terminal with my annotations as **** text **** :


>python main.py
2023-02-17 15:21:09 INFO discord.client logging in using static token
2023-02-17 15:21:10 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 60b9fce14faa5daa4aed9eb6db01a74d).
Max que: 50
Text Channel: 828698708123451434
Testing Bot#4591 is ready.
Passing message object
**** play() funciton is called ****
Play Called
Message object recieved: <message channel="<TextChannel" position="7" nsfw="False" news="False"> type= author=<member discriminator="'0199'" bot="False" nick="'Fragnk7?'" guild="<Guild" chunked="True">> flags=<messageflags value="0">>
2023-02-17 15:21:16 INFO discord.voice_client Connecting to voice...
2023-02-17 15:21:16 INFO discord.voice_client Starting voice handshake... (connection attempt 1)
2023-02-17 15:21:17 INFO discord.voice_client Voice handshake complete. Endpoint found seattle2004.discord.media
Current song: https://www.youtube.com/watch?v=vcAp4nmTZCA
[youtube] Extracting URL: https://www.youtube.com/watch?v=vcAp4nmTZCA 
[youtube] vcAp4nmTZCA: Downloading webpage 
[youtube] vcAp4nmTZCA: Downloading android player API JSON 
**** Does not play any audio ****
Playing rn
Song done
2023-02-17 15:21:18 INFO discord.player ffmpeg process 20700 successfully terminated with return code of 1.
2023-02-17 15:21:19 INFO discord.voice_client The voice handshake is being terminated for Channel ID 400178308467392513 (Guild ID 261601676941721602)
2023-02-17 15:21:19 INFO discord.voice_client Disconnecting from voice normally, close code 1000.
</messageflags></member></message>


On Discord's end, the bot successfully connects then disconnects after 2 second.


Note : I've only included code I think is relevant. Please let me know if I should add anything else to the post, otherwise, here is the github for the project. Code is in main.py.
https://github.com/LukeLeimbach/wallMomentMusic


Thank you in advance !


I've applied the advice from these posts but it still will not play audio :


-
https://stackoverflow.com/questions/45770016/how-do-i-make-my-discord-bot-play-audio-from-youtube


-
https://stackoverflow.com/questions/66070749/how-to-fix-discord-music-bot-that-stops-playing-before-the-song-is-actually-over?newreg=c70dd786cf5844e490045494223c0381


-
https://stackoverflow.com/questions/57688808/playing-music-with-a-bot-from-youtube-without-downloading-the-file


-
Rotating gyro data in gopro footage with ffpmeg
2 juillet 2023, par FPV ShenanigansI believe orientation of gyro data in some of my gopro clips is wrong. Reelsteady runs stabilization ok but it results in even worse than initial video shaky effect. I have filmed with gopro in 90 degree with orientation locked .


Is it possible to amend metadata if ffmpeg to fix this ?


the below is an example clip


Metadata :
major_brand : isom
minor_version : 512
compatible_brands : isomiso2mp41
encoder : Lavf60.10.100
Duration : 00:04:30.22, start : 0.000000, bitrate : 119132 kb/s
Stream #0:00x1 : Video : hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(pc, bt709), 3840x3360 [SAR 1:1 DAR 8:7], 118934 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
Metadata :
handler_name : GoPro H.265
vendor_id : [0][0][0][0]
encoder : GoPro H.265 encoder
timecode : 13:27:43:05
Side data :
displaymatrix : rotation of -90.00 degrees
Stream #0:10x2 : Audio : aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata :
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
Stream #0:20x3 : Data : none (tmcd / 0x64636D74)
Metadata :
handler_name : GoPro H.265
timecode : 13:27:43:05


tried this


ffmpeg.exe -i "F :\2023 THE ONLY COPY\Chasing surfers\GX010223.MP4" -c copy -metadata:s:v rotate=90 "F :\2023 THE ONLY COPY\Chasing surfers\GX010223_test.mp4"


but reelsteady can't read metadata from a new video


-
Using aler9/rtsp-simple-server, able to stream HLS from file but not from ffmpeg's stdin
11 avril 2023, par PowercoderUPD : hehe, it actially works, but in chrome, not mozilla


I want to display programmatically generated stream on a webpage in real time. For this I have rtsp-simple-server with RTSP and HLS enabled. I managed to publish a stream from file with command
ffmpeg -re -stream_loop -1 -i file.mp4 -vcodec libx264 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream
and see it at http://localhost:8888/mystream.

But when I'm trying to do the same with python from the ffmpeg's stdin, I'm getting infinitely loading video instead of stream and browser console says "Uncaught (in promise) DOMException : The fetching process for the media resource was aborted by the user agent at the user's request". Here is my code :


import random
import shlex
import subprocess
import time

import numpy as np


def main():
 width = 1024
 height = 720
 framerate = 1
 frame_duration = 1 / framerate
 cmd = shlex.split(
 f'ffmpeg'
 f' -y'
 f' -f rawvideo'
 f' -vcodec rawvideo'
 f' -s {width}x{height}'
 f' -pix_fmt bgr24'
 f' -r {framerate}'
 f' -i -'
 f' -r {framerate}'
 f' -force_key_frames expr:eq(mod(n,3),0)'
 f' -vcodec libx264'
 f' -crf 18'
 f' -preset ultrafast'
 f' -tune zerolatency'
 f' -f rtsp'
 f' -rtsp_transport tcp'
 f' rtsp://localhost:8554/mystream'
 )
 ffmpeg_process = subprocess.Popen(cmd, stdin=subprocess.PIPE)
 try:
 while True:
 image = np.full(
 (height, width, 3),
 (
 random.randint(0, 255),
 random.randint(0, 255),
 random.randint(0, 255),
 ),
 dtype=np.uint8,
 )
 ffmpeg_process.stdin.write(image.tobytes())
 time.sleep(frame_duration)
 finally:
 ffmpeg_process.stdin.close()
 ffmpeg_process.wait()


if __name__ == '__main__':
 main()




In the server's logs seems like no bad messages instead of single 404 status (is it just about favicon, right ?)


2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] GET /mystream/
2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [c->s] GET /mystream/ HTTP/1.1
Host: localhost:8888
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Connection: keep-alive
Cookie: csrftoken=iRZDO5rsJzhh5peyyKhViN9yRslNQbuZ; Webstorm-713207de=ca4f5f1e-40e8-4bfd-97da-1be2f15f6e9e
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0


2023/03/25 13:50:32 INF [HLS] [muxer mystream] created (requested by 172.18.0.1)
2023/03/25 13:50:32 INF [HLS] [muxer mystream] is converting into HLS, 1 track (H264)
2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [s->c] HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: text/html
Server: rtsp-simple-server

(body of 1240 bytes)
2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] GET /favicon.ico
2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [c->s] GET /favicon.ico HTTP/1.1
Host: localhost:8888
Accept: image/avif,image/webp,*/*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Connection: keep-alive
Cookie: csrftoken=iRZDO5rsJzhh5peyyKhViN9yRslNQbuZ; Webstorm-713207de=ca4f5f1e-40e8-4bfd-97da-1be2f15f6e9e
Referer: http://localhost:8888/mystream/
Sec-Fetch-Dest: image
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0


2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [s->c] HTTP/1.1 404 Not Found
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Server: rtsp-simple-server


2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] GET /mystream/index.m3u8
2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [c->s] GET /mystream/index.m3u8 HTTP/1.1
Host: localhost:8888
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Connection: keep-alive
Cookie: csrftoken=iRZDO5rsJzhh5peyyKhViN9yRslNQbuZ; Webstorm-713207de=ca4f5f1e-40e8-4bfd-97da-1be2f15f6e9e
Referer: http://localhost:8888/mystream/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0


2023/03/25 13:50:32 DEB [HLS] [conn 172.18.0.1] [s->c] HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/x-mpegURL
Server: rtsp-simple-server

(body of 122 bytes)
2023/03/25 13:50:34 DEB [HLS] [conn 172.18.0.1] GET /mystream/index.m3u8
2023/03/25 13:50:34 DEB [HLS] [conn 172.18.0.1] [c->s] GET /mystream/index.m3u8 HTTP/1.1
Host: localhost:8888
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Connection: keep-alive
Cookie: csrftoken=iRZDO5rsJzhh5peyyKhViN9yRslNQbuZ; Webstorm-713207de=ca4f5f1e-40e8-4bfd-97da-1be2f15f6e9e
Referer: http://localhost:8888/mystream/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0


2023/03/25 13:50:34 DEB [HLS] [conn 172.18.0.1] [s->c] HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/x-mpegURL
Server: rtsp-simple-server

(body of 122 bytes)
2023/03/25 13:50:36 DEB [HLS] [conn 172.18.0.1] GET /mystream/index.m3u8
2023/03/25 13:50:36 DEB [HLS] [conn 172.18.0.1] [c->s] GET /mystream/index.m3u8 HTTP/1.1
Host: localhost:8888
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Connection: keep-alive
Cookie: csrftoken=iRZDO5rsJzhh5peyyKhViN9yRslNQbuZ; Webstorm-713207de=ca4f5f1e-40e8-4bfd-97da-1be2f15f6e9e
Referer: http://localhost:8888/mystream/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0


2023/03/25 13:50:36 DEB [HLS] [conn 172.18.0.1] [s->c] HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Content-Type: application/x-mpegURL
Server: rtsp-simple-server

(body of 122 bytes)




How do I get my stream from python visible on a webpage ?