
Recherche avancée
Autres articles (94)
-
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...) -
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.
Sur d’autres sites (7424)
-
FFmpeg Streaming Video SpringBoot endpoint not show video duration in video players
7 avril 2024, par lxluxo23it turns out that I've been working on a personal project just out of curiosity.
the main function is to stream video by first encoding it through ffmpeg
then playback said video from any other device
call it "plex" very very primitive


although I achieve my goal which is to encode and send the video to the devices that make the request
this video is sent so to speak as a live broadcast.
I can only pause it, no forward or rewind, anyone have any idea what I am doing wrong or if I should take some other approach either in my service or controller ?


I leave fragments of my code


THE CONTROLLER


@RestController
@RequestMapping("/api")
@Log4j2
public class StreamController {

 @Autowired
 VideoStreamingService videoStreamingService;

 @Autowired
 VideoService videoService;


 @GetMapping("/stream/{videoId}")
 public ResponseEntity<streamingresponsebody> livestream(@PathVariable Long videoId,@RequestParam(required = false) String codec) {
 Video video = videoService.findVideoById(videoId);
 if (video != null) {
 Codec codecEnum = Codec.fromString(codec);
 return ResponseEntity.ok()
 .contentType(MediaType.valueOf("video/mp4"))
 .body(outputStream -> videoStreamingService.streamVideo(video.getPath(), outputStream,codecEnum));
 }
 return ResponseEntity.notFound().build();
 }
}
</streamingresponsebody>


THE SERVICE


@Service
public class VideoStreamingService {

 public void streamVideo(String videoPath, OutputStream outputStream, Codec codec) {

 FFmpeg ffmpeg = FFmpeg.atPath()
 .addArguments("-i", videoPath)
 .addArguments("-b:v", "5000k")
 .addArguments("-maxrate", "5000k")
 .addArguments("-bufsize", "10000k")
 .addArguments("-c:a", "aac")
 .addArguments("-b:a", "320k")
 .addArguments("-movflags", "frag_keyframe+empty_moov+faststart")
 .addOutput(PipeOutput.pumpTo(outputStream)
 .setFormat("mp4"))
 .addArgument("-nostdin");
 if (codec == Codec.AMD) {
 ffmpeg.addArguments("-profile:v", "high");
 }
 ffmpeg.addArguments("-c:v", codec.getFfmpegArgument());
 ffmpeg.execute();
 }
}



I have some enums to vary the encoding and use hardware acceleration or not.


and here is an example from my player
the endpoint is the following


http://localhost:8080/api/stream/2?codec=AMD

screenshot

I'm not sure if there's someone with more knowledge in either FFmpeg or Spring who could help me with this minor issue, I would greatly appreciate it. I've included the URL of the repository in case anyone would like to review it when answering my question




I tried changing the encoding format.
I tried copying the metadata from the original video.
I tried sending a custom header.
None of this has worked.


I would like to achieve what is mentioned in many sites, which is when you load a video from the network, the player shows how much of that video you have in the local "buffer".


-
Discord music bot won't join Voice channel
16 mars 2024, par SkelyI followed a tutorial for creating a music bot in discord, but it will not join my vc no matter what. Every command works and it gives the correct responses and songs is in the queue. The bot have every permission know to man, but it still won't join. Any way to fix this issue ?
Thanks in advance !!


This is my code and files


main.py


import discord
from discord.ext import commands
import os
import asyncio

from help_cog import help_cog
from music_cog import music_cog

bot = commands.Bot(
 command_prefix="?", 
 intents=discord.Intents.all(),
 help_command=None
)

async def main():
 async with bot:
 await bot.add_cog(help_cog(bot))
 await bot.add_cog(music_cog(bot))
 await bot.start(os.getenv("TOKEN"))

asyncio.run(main())



music_cog.py


import discord
from discord.ext import commands

from yt_dlp import YoutubeDL

import yt_dlp as youtube_dl

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

 self.is_playing = False
 self.is_paused = False

 self.music_queue = []
 self.YDL_OPTIONS = {"format": "bestaudio", "postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", "preferredquality": "192",}]}
 self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

 self.vc = None
 print("Success")

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

 def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = True

 m_url = self.music_queue[0][0]["source"]

 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

 async def play_music(self, ctx):
 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("Could not connect to the voice channel")
 return
 else:
 await self.vc.move_to(self.music_queue[0][1])
 
 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

 @commands.command(name="play", aliases=["p", "playing"], help="Play the 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("Connect to a voice channel!")
 elif self.is_paused:
 self.vc.resume()
 else:
 song = self.search_yt(query)
 if type(song) == type(True):
 await ctx.send("Could not download the song. Incorrect format, try a different keyword")
 else:
 await ctx.send("Song added to queue")
 self.music_queue.append([song, voice_channel])

 if self.is_playing == False:
 await self.play_music(ctx)
 
 @commands.command(name="pause", help="Pauses the current song being played")
 async def pause(self, ctx, *args):
 if self.is_playing:
 self.is_playing = False
 self.is_paused = True
 self.vc.pause()
 elif self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()

 @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")
 async def resume(self, ctx, *args):
 if self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()
 
 @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")
 async def skip(self, ctx, *args):
 if self.vc != None and self.vc:
 self.vc.stop()
 await self.play_music(ctx)

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

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

 if retval != "":
 await ctx.send(retval)
 else:
 await ctx.send("No music in the current queue")
 
 @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")
 async def clear(self, ctx, *args):
 if self.vc != None and self.is_playing:
 self.vc.stop()
 self.music_queue = []
 await ctx.send("Music queue cleared")

 @commands.command(name="leave", aliases=["disconnect", "l", "d"], help="Kick the bot from the voice channel")
 async def leave(self, ctx):
 self.is_playing = False
 self.is_paused = False
 await self.vc.disconnect()



help_cog.py


import discord
from discord.ext import commands

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

 self.help_message = """
 Help message
"""

 self.text_channel_text = []
 
 @commands.Cog.listener()
 async def on_ready(self):
 for guild in self.bot.guilds:
 for channel in guild.text_channels:
 self.text_channel_text.append(channel)

 await self.send_to_all(self.help_message)

 async def send_to_all(self, msg):
 for text_channel in self.text_channel_text:
 await text_channel.send(msg)
 
 @commands.command(name="help", help="Displays all the available commands")
 async def help(self, ctx):
 await ctx.send(self.help_message)



-
Error while linking shared library FFMpegJNI to android project
5 mars 2024, par Dari VI have built an ffmpeg module for all the architectures, but when I try to build project to run it on emulator (x86 architecture) i get an error, indicating that the files for x86 architecture are incompatible with elf_i386. The same is for other architectures, i get the error that the files are incompatible. What can i do in this case ?


[2/2] Linking CXX shared library E:\android_studio_projects\projects\IPTVPlayer\app\build\intermediates\cxx\Debug\1h3dp6s4\obj\x86\libffmpegJNI.so
FAILED: E:/android_studio_projects/projects/IPTVPlayer/app/build/intermediates/cxx/Debug/1h3dp6s4/obj/x86/libffmpegJNI.so 
cmd.exe /C "cd . && C:\Users\volos\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android30 --sysroot=C:/Users/volos/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libffmpegJNI.so -o E:\android_studio_projects\projects\IPTVPlayer\app\build\intermediates\cxx\Debug\1h3dp6s4\obj\x86\libffmpegJNI.so CMakeFiles/ffmpegJNI.dir/E_/media3/media-release/libraries/decoder_ffmpeg/src/main/jni/ffmpeg_jni.cc.o -landroid E:/media3/media-release/libraries/decoder_ffmpeg/src/main/jni/ffmpeg/android-libs/x86/libswresample.a E:/media3/media-release/libraries/decoder_ffmpeg/src/main/jni/ffmpeg/android-libs/x86/libavcodec.a E:/media3/media-release/libraries/decoder_ffmpeg/src/main/jni/ffmpeg/android-libs/x86/libavutil.a C:/Users/volos/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/i686-linux-android/30/liblog.so -latomic -lm && cd ."
ld: error: E:/media3/media-release/libraries/decoder_ffmpeg/src/main/jni/ffmpeg/android-libs/x86/libavcodec.a(mpegaudiotabs.o) is incompatible with elf_i386