
Recherche avancée
Médias (91)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
avec chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
sans chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
config chosen
13 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (31)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
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 ) (...)
Sur d’autres sites (6420)
-
Unable to stream video file from MediaMTX media server to browser via WebRTC
8 juin 2024, par thegreatjediI took over a repository at work. It's a working demo comprising a web server which receives video and camera feeds from a media server (built from the rtsp-simple-server Docker image) via a RTSP relay server and streams the feeds to the client, all deployed via Docker Compose.


I'm trying to switch over to use WebRTC instead. rtsp-simple-server has upgraded into MediaMTX since the time the demo was created 2 years ago. This is the relevant section of the updated Docker Compose configuration :


media-server:
 image: bluenviron/mediamtx:latest-ffmpeg
 expose:
 - 8889
 init: true
 ports:
 - 8889:8889
 restart: unless-stopped
 volumes:
 - type: bind
 source: ./demo/vids
 target: /vids
 - type: bind
 source: ./demo/mediamtx.yml
 target: /mediamtx.yml



Relevant part of the MediaMTX custom configuration in
mediamtx.yml
:

###############################################
# Path settings

# Settings in "paths" are applied to specific paths, and the map key
# is the name of the path.
# Any setting in "pathDefaults" can be overridden here.
# It's possible to use regular expressions by using a tilde as prefix,
# for example "~^(test1|test2)$" will match both "test1" and "test2",
# for example "~^prefix" will match all paths that start with "prefix".
paths:
 # example:
 # my_camera:
 # source: rtsp://my_camera
 ~^demo\d+$:
 runOnDemand: ffmpeg -re -stream_loop -1 -i /vids/$MTX_PATH.mp4 -c:v libvpx -b:v 0 -crf 18 -qmin 18 -qmax 18 -f webm http://localhost:8889/$MTX_PATH/whip

 # Settings under path "all_others" are applied to all paths that
 # do not match another entry.
 all_others:



I've absolutely no experience with WebRTC. This is my first time hearing of this protocol, let alone working with it. From what I understand, I need to convert my demo mp4 videos (which were successfully streaming via RTSP in the previous implementation) to a compatible video codec, so I've opted for VP8.


Before trying to stream the videos into my web server, I tested the stream directly in the browser (tried with both the latest versions of Chrome and Edge). I went to
http://localhost:8889/demo0
(which should convert demo0.mp4 to VP8 and then stream it over WebRTC). The video player loaded in the browser but no video data was received and nothing played. After several seconds, the screen displayed "Error : bad status code 400, retrying in some seconds". In the browser console, it showed :

Failed to load resource : the server responded with a status of 400 (Bad Request)


Inside the MediaMTX container's runtime logs, this is what's displayed :


2024-04-02 14:53:08 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
2024-04-02 14:53:08 built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014
2024-04-02 14:53:08 configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto=auto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl
2024-04-02 14:53:08 libavutil 58. 29.100 / 58. 29.100
2024-04-02 14:53:08 libavcodec 60. 31.102 / 60. 31.102
2024-04-02 14:53:08 libavformat 60. 16.100 / 60. 16.100
2024-04-02 14:53:08 libavdevice 60. 3.100 / 60. 3.100
2024-04-02 14:53:08 libavfilter 9. 12.100 / 9. 12.100
2024-04-02 14:53:08 libswscale 7. 5.100 / 7. 5.100
2024-04-02 14:53:08 libswresample 5. 0.100 / 5. 0.100
2024-04-02 14:53:08 libpostproc 57. 3.100 / 57. 3.100
2024-04-02 14:53:08 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/vids/demo0.mp4':
2024-04-02 14:53:08 Metadata:
2024-04-02 14:53:08 major_brand : isom
2024-04-02 14:53:08 minor_version : 512
2024-04-02 14:53:08 compatible_brands: isomiso2mp41
2024-04-02 14:53:08 encoder : Lavf58.76.100
2024-04-02 14:53:08 Duration: 00:00:03.47, start: 0.000000, bitrate: 1675 kb/s
2024-04-02 14:53:08 Stream #0:0[0x1](und): Video: mpeg1video (mp4v / 0x7634706D), yuv420p(tv, progressive), 640x360 [SAR 1:1 DAR 16:9], 104857 kb/s, 30 fps, 30 tbr, 90k tbn (default)
2024-04-02 14:53:08 Metadata:
2024-04-02 14:53:08 handler_name : VideoHandler
2024-04-02 14:53:08 vendor_id : [0][0][0][0]
2024-04-02 14:53:08 Side data:
2024-04-02 14:53:08 cpb: bitrate max/min/avg: 0/0/0 buffer size: 49152 vbv_delay: N/A
2024-04-02 14:53:08 Stream mapping:
2024-04-02 14:53:08 Stream #0:0 -> #0:0 (mpeg1video (native) -> vp8 (libvpx))
2024-04-02 14:53:08 Press [q] to stop, [?] for help
2024-04-02 14:53:08 [libvpx @ 0x7faa8591b8c0] v1.13.1
2024-04-02 14:53:08 [libvpx @ 0x7faa8591b8c0] Bitrate not specified for constrained quality mode, using default of 256kbit/sec
2024-04-02 14:53:08 Output #0, webm, to 'http://localhost:8889/demo0/whip':
2024-04-02 14:53:08 Metadata:
2024-04-02 14:53:08 major_brand : isom
2024-04-02 14:53:08 minor_version : 512
2024-04-02 14:53:08 compatible_brands: isomiso2mp41
2024-04-02 14:53:08 encoder : Lavf60.16.100
2024-04-02 14:53:08 Stream #0:0(und): Video: vp8, yuv420p(tv, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 256 kb/s, 30 fps, 1k tbn (default)
2024-04-02 14:53:08 Metadata:
2024-04-02 14:53:08 handler_name : VideoHandler
2024-04-02 14:53:08 vendor_id : [0][0][0][0]
2024-04-02 14:53:08 encoder : Lavc60.31.102 libvpx
2024-04-02 14:53:08 Side data:
2024-04-02 14:53:08 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
2024-04-02 14:53:18 2024/04/02 06:53:18 INF [path demo0] runOnDemand command stopped: timed out
2024-04-02 14:53:18 2024/04/02 06:53:18 INF [WebRTC] [session 0f460c76] closed: source of path 'demo0' has timed out
[out#0/webm @ 0x7faa859487c0] video:272kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.042856%
2024-04-02 14:53:18 frame= 315 fps= 32 q=18.0 Lsize= 275kB time=00:00:10.46 bitrate= 215.1kbits/s speed=1.05x 
2024-04-02 14:53:18 Exiting normally, received signal 2.



I'm not sure what this is supposed to mean ? Why isn't the server able to stream this 3-second, 709kb video even once ? The browser connected to the server and the URL successfully, but no data was being transferred.


Just in case, I decided to manually convert all of my mp4 files to webm using ffmpeg, and verified with Window's media player that the webm videos work. Then, I modified MediaMTX's configuration to stream the webm videos directly :


paths:
 # example:
 # my_camera:
 # source: rtsp://my_camera
 ~^demo\d+$:
 runOnDemand: ffmpeg -re -stream_loop -1 -i /vids/$MTX_PATH.webm -c copy -f webm http://localhost:8889/$MTX_PATH/whip



However, the error persists :


2024-04-02 15:03:58 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
2024-04-02 15:03:58 built with gcc 13.2.1 (Alpine 13.2.1_git20231014) 20231014
2024-04-02 15:03:58 configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto=auto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 --enable-libvpl
2024-04-02 15:03:58 libavutil 58. 29.100 / 58. 29.100
2024-04-02 15:03:58 libavcodec 60. 31.102 / 60. 31.102
2024-04-02 15:03:58 libavformat 60. 16.100 / 60. 16.100
2024-04-02 15:03:58 libavdevice 60. 3.100 / 60. 3.100
2024-04-02 15:03:58 libavfilter 9. 12.100 / 9. 12.100
2024-04-02 15:03:58 libswscale 7. 5.100 / 7. 5.100
2024-04-02 15:03:58 libswresample 5. 0.100 / 5. 0.100
2024-04-02 15:03:58 libpostproc 57. 3.100 / 57. 3.100
2024-04-02 15:03:58 Input #0, matroska,webm, from '/vids/demo0.webm':
2024-04-02 15:03:58 Metadata:
2024-04-02 15:03:58 COMPATIBLE_BRANDS: isomiso2mp41
2024-04-02 15:03:58 MAJOR_BRAND : isom
2024-04-02 15:03:58 MINOR_VERSION : 512
2024-04-02 15:03:58 ENCODER : Lavf60.16.100
2024-04-02 15:03:58 Duration: 00:00:03.47, start: 0.000000, bitrate: 217 kb/s
2024-04-02 15:03:58 Stream #0:0: Video: vp8, yuv420p(tv, progressive), 640x360, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn (default)
2024-04-02 15:03:58 Metadata:
2024-04-02 15:03:58 HANDLER_NAME : VideoHandler
2024-04-02 15:03:58 VENDOR_ID : [0][0][0][0]
2024-04-02 15:03:58 ENCODER : Lavc60.31.102 libvpx
2024-04-02 15:03:58 DURATION : 00:00:03.466000000
2024-04-02 15:03:58 Output #0, webm, to 'http://localhost:8889/demo0/whip':
2024-04-02 15:03:58 Metadata:
2024-04-02 15:03:58 COMPATIBLE_BRANDS: isomiso2mp41
2024-04-02 15:03:58 MAJOR_BRAND : isom
2024-04-02 15:03:58 MINOR_VERSION : 512
2024-04-02 15:03:58 encoder : Lavf60.16.100
2024-04-02 15:03:58 Stream #0:0: Video: vp8, yuv420p(tv, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30 tbr, 1k tbn (default)
2024-04-02 15:03:58 Metadata:
2024-04-02 15:03:58 HANDLER_NAME : VideoHandler
2024-04-02 15:03:58 VENDOR_ID : [0][0][0][0]
2024-04-02 15:03:58 ENCODER : Lavc60.31.102 libvpx
2024-04-02 15:03:58 DURATION : 00:00:03.466000000
2024-04-02 15:03:58 Stream mapping:
2024-04-02 15:03:58 Stream #0:0 -> #0:0 (copy)
2024-04-02 15:03:58 Press [q] to stop, [?] for help
2024-04-02 15:04:08 2024/04/02 07:04:08 INF [path demo0] runOnDemand command stopped: timed out
2024-04-02 15:04:08 2024/04/02 07:04:08 INF [WebRTC] [session 829664cb] closed: source of path 'demo0' has timed out
[out#0/webm @ 0x7f04b00515c0] video:281kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.023511%
2024-04-02 15:04:08 size= 284kB time=00:00:10.49 bitrate= 221.3kbits/s speed=1.05x 
2024-04-02 15:04:08 Exiting normally, received signal 2.



This is the same when I try to stream my other videos (demo1.mp4, demo2.mp4 etc.). What am I doing wrong ?


-
How to use multiple cookies in FFmpeg ?
17 mai 2023, par カルロサグI am trying to use cookies in ffmpeg to download a video that requires cookies


I checked the documentation for multiple cookies using the "-cookies" argument, they must be separated by a newline, but the docs don't show an example of how to do it, there is only an example for the cookies syntax using a single cookie. I've tried "\n" and "\r\n" (used by the "-headers" argument) and they didn't work : I get a 403 response error


Using a regular HTTP client such as curl or aiohttp (python) downloads the video, so the cookies and headers I provided are correct


First test : Cookies as headers


ffprobe -i "https://cdn12.tokyvideo.com/videos/215/215164/mp4/d41bdb167b322ab0b5bf03e9cd64c4c2edb5939e9ba56403afb52297c2ae97be.mp4?nva=20230227154655&nvb=20230223154655&token=0fe81937ec54cc94ab459" -user_agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0" -headers "Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Host: www.tokyvideo.com
Referer: https://www.tokyvideo.com
Cookie: XSRF-TOKEN=eyJpdiI6IjNzMGJQb3duNVVNNFJFS0VUdW5MV3c9PSIsInZhbHVlIjoiMWhQRlVlUUxST01IblFXdFM3ZVQzYUZHd2ZRamdGR2JCejNpSmhaMHlwSjBwcksyeHF0UWRsZFhQd244ZW9wTzNsbmdBd2JiM2luTjR2TVhxdEdNdGJQaXE3S3BJM2J5WVljaEtXbFRMRm1aUjVTS2hQVDFVWkphUkc0bjBZSUsiLCJtYWMiOiI0ODJjZjIxZjkzZGQyZjU2YTAzNjNlYzQxMGU5YTQxYjdlZGZkZGJjYWFiZGNhYzRlMzBhZTZiY2MyYjA5OTI3In0%3D; Domain=tokyvideo.com; expires=Sat, 04-Mar-2023 15:46:56 GMT; Max-Age=604800; Path=/
Cookie: tokyvideo_session=eyJpdiI6InVEUkxxUmdTZDJtZnNmeWpqaE9mTWc9PSIsInZhbHVlIjoid1kzVTVZbmtpRHJDUDZOc25pMnRMOFBCRk1IOTVXN3dMc3Y5MmlzaGh6NzVZM0xOMlNCOTB5bTFIemdLXC9ZWE14UGhKUHN2OEFJZDZhR241bG5FcGw0aHpHeTRnbUF0cGVVUkVqQUhReXllVTY1TmtGM2hsV0w5a3RxdCtBa09JIiwibWFjIjoiNzUxM2M1MTJiN2RiM2ZmOGZkYzViM2FkY2E1NTgwNjQzY2NjODIyNWQ4ZjRkMWUxZjc5ODU3NzQyZTQ4ZjJiZiJ9; Domain=tokyvideo.com; expires=Sat, 04-Mar-2023 15:46:56 GMT; HttpOnly; Max-Age=604800; Path=/



Returns 403


Second test : Cookies using -cookies the argument


ffprobe -i "https://cdn12.tokyvideo.com/videos/215/215164/mp4/d41bdb167b322ab0b5bf03e9cd64c4c2edb5939e9ba56403afb52297c2ae97be.mp4?nva=20230227154655&nvb=20230223154655&token=0fe81937ec54cc94ab459" -user_agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0" -headers "Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Host: www.tokyvideo.com
Referer: https://www.tokyvideo.com
" -cookies "XSRF-TOKEN=eyJpdiI6IjNzMGJQb3duNVVNNFJFS0VUdW5MV3c9PSIsInZhbHVlIjoiMWhQRlVlUUxST01IblFXdFM3ZVQzYUZHd2ZRamdGR2JCejNpSmhaMHlwSjBwcksyeHF0UWRsZFhQd244ZW9wTzNsbmdBd2JiM2luTjR2TVhxdEdNdGJQaXE3S3BJM2J5WVljaEtXbFRMRm1aUjVTS2hQVDFVWkphUkc0bjBZSUsiLCJtYWMiOiI0ODJjZjIxZjkzZGQyZjU2YTAzNjNlYzQxMGU5YTQxYjdlZGZkZGJjYWFiZGNhYzRlMzBhZTZiY2MyYjA5OTI3In0%3D; Domain=tokyvideo.com; expires=Sat, 04-Mar-2023 15:46:56 GMT; Max-Age=604800; Path=/;
tokyvideo_session=eyJpdiI6InVEUkxxUmdTZDJtZnNmeWpqaE9mTWc9PSIsInZhbHVlIjoid1kzVTVZbmtpRHJDUDZOc25pMnRMOFBCRk1IOTVXN3dMc3Y5MmlzaGh6NzVZM0xOMlNCOTB5bTFIemdLXC9ZWE14UGhKUHN2OEFJZDZhR241bG5FcGw0aHpHeTRnbUF0cGVVUkVqQUhReXllVTY1TmtGM2hsV0w5a3RxdCtBa09JIiwibWFjIjoiNzUxM2M1MTJiN2RiM2ZmOGZkYzViM2FkY2E1NTgwNjQzY2NjODIyNWQ4ZjRkMWUxZjc5ODU3NzQyZTQ4ZjJiZiJ9; Domain=tokyvideo.com; expires=Sat, 04-Mar-2023 15:46:56 GMT; HttpOnly; Max-Age=604800; Path=/;"



Returns 403, using either "\n" or "\r\n" to split the cookies


Output :


built with gcc 10 (Debian 10.2.1-6)
 configuration: --prefix=/usr --extra-version=0+deb11u2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
[https @ 0x557191d9b840] HTTP error 403 Forbidden
https://cdn12.tokyvideo.com/videos/215/215164/mp4/d41bdb167b322ab0b5bf03e9cd64c4c2edb5939e9ba56403afb52297c2ae97be.mp4?nva=20230227154655&nvb=20230223154655&token=0fe81937ec54cc94ab459: Server returned 403 Forbidden (access denied)



-
Python Discord music bot stops playing a couple of minutes into any song
9 mars 2023, par knewbyI am trying to put together a Python Discord music bot as a fun little project. Outside of the required discord library I'm currently using the YouTube API to search for videos and parse the URL (not shown in code), yt-dlp which is a fork of yt_download that is still maintained to get the info from the YT URL, and FFMPEG to play the song obtained from yt-dlp through the bot. My play command seems to work as the 1st YT video result will start to play, but roughly 30-90 seconds into the audio, it stops playing. I get this message in the console :


2023-02-23 14:54:44 IN discord.player ffmpeg process 4848 successfully terminated with return code of 0.


So there is no error for me to go off of. I've included the full output from the console below...


-----------------------------------
groovy-jr#6741 is up and running
-----------------------------------
2023-02-23 14:53:23 INFO discord.voice_client Connecting to voice...
2023-02-23 14:53:23 INFO discord.voice_client Starting voice handshake... (connection attempt 1)
2023-02-23 14:53:24 INFO discord.voice_client Voice handshake complete. Endpoint found us-south1655.discord.media
2023-02-23 14:54:44 INFO discord.player ffmpeg process 4848 successfully terminated with return code of 0. <= AUDIO STOPS



I'm currently developing this project on a Windows 11 machine, but I've had the issue running it on my Ubuntu machine as well. I am just hosting the bot directly from the VSCode terminal for development.


I've been trying to do research on this problem, the problem is I can't find many recent information for the issue. There was another post that talked about a similar problem and had an answer suggesting the following FFMPEG options be used which I tried to no avail.


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



I'll include the problem file below :


import discord
from discord.ext import commands
from discord import FFmpegPCMAudio
import responses
import youtubeSearch as YT
import yt_dlp

async def send_message(message, user_message, is_private = False):
 try:
 response = responses.handle_response(user_message)
 await message.author.send(response) if is_private else await message.channel.send(response)
 except Exception as e:
 print(e)

def run_discord_bot():
 intents = discord.Intents.default()
 intents.message_content = True

 TOKEN = 'xxxxxx'
 client = commands.Bot(command_prefix = '-', intents=intents)

 @client.event
 async def on_ready():
 print('-----------------------------------')
 print(f'{client.user} is up and running')
 print('-----------------------------------')

 @client.command(name='play', aliases=['p'], pass_context = True)
 async def play(ctx, *, search_term:str = None):
 if ctx.author.voice:
 voice = None
 if search_term == None:
 await ctx.send('No song specified.')
 return
 if not ctx.voice_client:
 channel = ctx.message.author.voice.channel
 voice = await channel.connect()
 else:
 voice = ctx.guild.voice_client
 
 url = YT.singleSearch(search_term)
 
 YTDLP_OPTIONS = {
 'format': 'bestaudio/best',
 'extractaudio': True,
 'audioformat': 'mp3',
 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
 'restrictfilenames': True,
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': False,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'ytsearch',
 'source_address': '0.0.0.0',
 }

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

 with yt_dlp.YoutubeDL(YTDLP_OPTIONS) as ydl:
 info = ydl.extract_info(url, download=False)
 playUrl = info['url']

 source = FFmpegPCMAudio(playUrl, options=FFMPEG_OPTIONS)
 voice.play(source)
 else:
 await ctx.send('You must be in a voice channel to play a song!')
 return

 @client.command(pass_context = True)
 async def leave(ctx):
 if ctx.voice_client:
 await ctx.guild.voice_client.disconnect()
 else:
 await ctx.send("I'm not in a voice channel!")

 @client.command(pass_context = True)
 async def pause(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 if voice.is_playing():
 voice.pause()
 else:
 await ctx.send('No audio playing...')

 @client.command(pass_context = True)
 async def resume(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 if voice.is_paused():
 voice.resume()
 else:
 await ctx.send('No audio paused...')

 @client.command(pass_context = True)
 async def stop(ctx):
 voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
 voice.stop()

 client.run(TOKEN)



I appreciate any guidance I can get !