
Recherche avancée
Autres articles (57)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (6709)
-
Audio decoding stopped working ffmpeg
17 juin 2016, par StevaI wrote little program for extracting raw audio date a little while ago. I was busy and in meanwhile I changed OS from Kubuntu 15.04 to 16.04. Libraries are dynamically linked in cmakelists.txt
target_link_libraries(
ffmpeg
#[[ Linking ffmpeg libraries - START ------------------]]
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libavcodec.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libavdevice.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libavutil.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libavfilter.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libavformat.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libswresample.so"
"${CMAKE_SOURCE_DIR}/extern_libs/libffmpeg/lib/libswscale.so"
#[[ Linking ffmpeg libraries - END --------------------]]
)I started working again on my code but code doesn’t work anymore.
if(av_read_frame(m_ctx, &avpkt) >= 0){
got_frame = 0;
avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);
detectSampleFormat((AVSampleFormat)decoded_frame->format);
m_data->allocateMemory(m_duration, decoded_frame->channels);
m_resampler->initResampler(m_fmt, decoded_frame->channel_layout, decoded_frame->sample_rate, decoded_frame->nb_samples);
m_resampler->resampleAudioFrame(decoded_frame, m_data);
}
while(av_read_frame(m_ctx, &avpkt) >= 0){
got_frame = 0;
avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);
m_resampler->resampleAudioFrame(decoded_frame, m_data);
}Decoded frame should contain information as channel_layout, number of channels and so on... But during execution of program those are 0 or nulls.
Can anyone help me with this ? I am unclear why this was working some while ago (I last worked on this code in March) and same code doesn’t work anymore.
EDIT :
I found problem. First frame which is read from file is damaged or something, so I just waited for first correct frame to initialize my components.This question can be closed.
-
Remove all non key frames from video without re-encoding
14 avril 2021, par TeamolI have a HEVC mkv video from which I need to remove all but key frames without re-encoding whole thing.


I found out that I can extra key frames using this


ffmpeg -i full.mkv -c:v copy -vf "select=eq(pict_type\,PICT_TYPE_I)" key.mkv



but I get :


Filtergraph 'select=eq(pict_type\,PICT_TYPE_I)' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.



What do I do ?


-
Discord.py : Access files on the computer of the person who sent a message. Play a song from the local drive of any user on the server
7 avril 2021, par daDibI have a bot that can play music from my computer. Is there a way to play a song from the computer of the person who sent the message ? My thought would be using
message.author
to somehow access the person's session and get into their drive. Here is my bot. It can join a voice channel, create playlists from local file paths, start a playlist or individual file with stop/pause/play/next/previous controls :

import discord
import os.path
import logging
import asyncio
from os import path

global ready 
global vc
global source
global songQueue
global songIndex
global commandList
global stopPlaylist

ready = False
stopPlaylist = False
songQueue = []
songIndex = 0

logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='D:\DnD\DiscordBot\discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)

client = discord.Client()
commands = [
 '!connect\nConnect to a voice channel by channel id. Use !channels to find the desired id.\nExample Command: !connect 827202170973323305\n\n',
 '!channels\nLists all voice channels and their connection id.\n\n',
 '!add\nAdd a file path to the playlist.\nExample Command: !add D:\\DnD\\DiscordBot\\mySong.mp3\n\n',
 '!delete\nDeletes the last song added to the playlist.\n\n',
 '!view\nDisplays the current playlist, in order.\n\n',
 '!playlist\nStarts the playlist from the beginning, or optionally add a number as the start position.\nExample Command: !playlist 3\n\n',
 '!playSong\nPlays a specified file.\nExample Command: !playSong D:\\DnD\\DiscordBot\\mySong.mp3\n\n',
 '!next\nPlays next song in playlist.\n\n',
 '!prev\nPlays previous song in playlist.\n\n',
 '!stop\nStops all music song. Playlist will restart from the beginning.\n\n',
 '!pause\nPauses the current song. Restart with !resumeSong.\n\n',
 '!resume\nResumes the current song.\n\n'
 '!status\nLets you know if the bot thinks it is playing music.'
 ]
commandList=''
for command in commands:
 commandList+=command

@client.event
async def on_ready():
 print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
 global ready 
 global vc
 global source
 global songQueue
 global songIndex
 global commandList
 global stopPlaylist

 if message.author == client.user:
 return
#!help
 if message.content.startswith('!help'):
 await message.channel.send('{0}'.format(commandList))
 return
#!connect
 if message.content.startswith('!connect'): 
 if ready:
 await message.channel.send('Bot [{0}] is already connected to a voice channel.'.format(client.user))
 return
 channel = int(message.content[9:])
 vc = await client.get_channel(channel).connect()
 ready = True
 await message.channel.send('Bot [{0}] is connecting to voice.'.format(client.user))
 return
#!channels
 if message.content.startswith('!channels'):
 channelList = ''
 for channel in client.get_all_channels():
 if channel.type == discord.ChannelType.voice:
 channelList += 'name: ' + channel.name + '\n'
 channelList += 'id: ' + str(channel.id) + '\n\n'
 await message.channel.send('{0}'.format(channelList))
 return
#!add
 if message.content.startswith('!add'):
 song = message.content[5:]
 if not path.exists(song):
 await message.channel.send('Song not found or invalid path specified.\nSpecified Path: {0}\nExample command: !addSong C:\\Users\\Public\\Music\\mySong.mp3'.format(song))
 return
 songQueue.append(song)
 await message.channel.send('Song added: {0}\nCurrent playist length: {1} song(s)'.format(song,len(songQueue)))
 return
#!delete
 if message.content.startswith('!delete'):
 if len(songQueue) == 0:
 await message.channel.send('Playlist is empty. Use !addSong, !viewList, and !playList to manage playlists.')
 return
 await message.channel.send('Removed song: {0}'.format(songQueue.pop()))
 return
#!view
 if message.content.startswith('!view'):
 if len(songQueue) == 0:
 await message.channel.send('Playlist is empty. Use !addSong, !deleteSong, and !playList to manage playlists.')
 return
 await message.channel.send('Current Playlist:\n{0}'.format('\n'.join(songQueue)))
 return
#play commands
 if message.content.startswith('!play'):
 if not ready:
 await message.channel.send('Bot [{0}] is not connected to a voice channel.'.format(client.user))
 return
#!playlist 
 if message.content.startswith('!playlist'):
 try:
 songIndex = int(message.content[10:]) - 1
 if songIndex >= len(songQueue):
 songIndex = len(songQueue) - 1
 except:
 pass 
 playSong()
 return
#!playSong
 if message.content.startswith('!playSong'):
 song = message.content[10:]
 if not path.exists(song):
 await message.channel.send('Song not found or invalid path specified.\nSpecified Path: {0}\nExample command: !play C:\\Users\\Public\\Music\\mySong.mp3'.format(song))
 return
 source = discord.FFmpegPCMAudio(song)
 vc.play(source, after=None)
 await message.channel.send('Playing song: {0}'.format(song))
 return
#!next
 if message.content.startswith('!next'):
 vc.stop()
#!prev
 if message.content.startswith('!prev'):
 songIndex -= 2
 if songIndex < -1:
 songIndex = -1
 vc.stop()
#!stop
 if message.content.startswith('!stop'):
 if not ready:
 await message.channel.send('Bot [{0}] is not connected to a voice channel.'.format(client.user))
 return
 vc.stop()
 songIndex = 0
 stopPlaylist = True
 await message.channel.send('Stopping music.')
 return
#!pause
 if message.content.startswith('!pause'):
 if not ready:
 await message.channel.send('Bot [{0}] is not connected to a voice channel.'.format(client.user))
 return
 vc.pause()
 await message.channel.send('Pausing music.')
 return
#!resume
 if message.content.startswith('!resume'):
 if not ready:
 await message.channel.send('Bot [{0}] is not connected to a voice channel.'.format(client.user))
 return
 vc.resume()
 await message.channel.send('Resuming music.')
 return
#!status
 if message.content.startswith('!status'):
 if not ready:
 await message.channel.send('Bot [{0}] is not connected to a voice channel.'.format(client.user))
 return
 if vc.is_playing():
 await message.channel.send('Something is playing.')
 return
 await message.channel.send('Nothing is playing.')
 return

def playSong():
 global songQueue
 global songIndex
 global vc
 try:
 song = songQueue[songIndex]
 source = discord.FFmpegPCMAudio(song)
 vc.play(source, after=nextSong)
 except Exception as e:
 print('playSong error {0}'.format(e))

def nextSong(error):
 global songQueue
 global songIndex
 global stopPlaylist
 try:
 songIndex += 1
 if songIndex >= len(songQueue):
 stopPlaylist = True
 if stopPlaylist:
 songIndex = 0
 stopPlaylist = False
 return
 futureFunction = asyncio.run_coroutine_threadsafe(playSong(), client.loop)
 futureFunction.result()
 except Exception as e:
 print('nextSong error {0}'.format(e))

#@client.event
#async def on_logout(user)
# global ready
# if user == client.user:
# ready = False

client.run('TOKEN')