
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 (36)
-
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
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 (...) -
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)
Sur d’autres sites (4700)
-
When I use ffmpeg to go from a video to frames, and then back to video, the duration is different between the videos
24 février 2024, par bluepandaI am trying to use
ffmpeg
to convert from a .mp4 (or .mov) video into individual frames, do some processing on those frames, and then convert back to .mp4. The problem is that the resulting video I create is a different duration than the input - I can see this visually when I play the two videos side by side. The difference is not large (i.e.00:00:00.50
for the input video and00:00:00.52
for the output video), but when the videos are looped next to each other they get out of sync.

Here is information about the input video retrieved using
fluent-ffmpeg
'sffmpeg.ffprobe(videoPath)
:

metadata {
 streams: [
 {
 index: 0,
 codec_name: 'h264',
 codec_long_name: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
 profile: 'High',
 codec_type: 'video',
 codec_tag_string: 'avc1',
 codec_tag: '0x31637661',
 width: 1080,
 height: 1920,
 coded_width: 1080,
 coded_height: 1920,
 closed_captions: 0,
 has_b_frames: 2,
 sample_aspect_ratio: 'N/A',
 display_aspect_ratio: 'N/A',
 pix_fmt: 'yuv420p',
 level: 40,
 color_range: 'tv',
 color_space: 'bt709',
 color_transfer: 'bt709',
 color_primaries: 'bt709',
 chroma_location: 'left',
 field_order: 'unknown',
 refs: 1,
 is_avc: 'true',
 nal_length_size: 4,
 id: 'N/A',
 r_frame_rate: '30000/1001',
 avg_frame_rate: '27000/1001',
 time_base: '1/30000',
 start_pts: 0,
 start_time: 0,
 duration_ts: 15100,
 duration: 0.503333,
 bit_rate: 5660223,
 max_bit_rate: 'N/A',
 bits_per_raw_sample: 8,
 nb_frames: 36,
 nb_read_frames: 'N/A',
 nb_read_packets: 'N/A',
 tags: [Object],
 disposition: [Object]
 },
 {
 index: 1,
 codec_name: 'aac',
 codec_long_name: 'AAC (Advanced Audio Coding)',
 profile: 'LC',
 codec_type: 'audio',
 codec_tag_string: 'mp4a',
 codec_tag: '0x6134706d',
 sample_fmt: 'fltp',
 sample_rate: 48000,
 channels: 2,
 channel_layout: 'stereo',
 bits_per_sample: 0,
 id: 'N/A',
 r_frame_rate: '0/0',
 avg_frame_rate: '0/0',
 time_base: '1/48000',
 start_pts: 0,
 start_time: 0,
 duration_ts: 24160,
 duration: 0.503333,
 bit_rate: 248416,
 max_bit_rate: 'N/A',
 bits_per_raw_sample: 'N/A',
 nb_frames: 27,
 nb_read_frames: 'N/A',
 nb_read_packets: 'N/A',
 tags: [Object],
 disposition: [Object]
 }
 ],
 format: {
 filename: '/Users/name/images/input.mp4',
 nb_streams: 2,
 nb_programs: 0,
 format_name: 'mov,mp4,m4a,3gp,3g2,mj2',
 format_long_name: 'QuickTime / MOV',
 start_time: 0,
 duration: 0.503333,
 size: 963879,
 bit_rate: 15319941,
 probe_score: 100,
 tags: {
 major_brand: 'mp42',
 minor_version: '1',
 compatible_brands: 'isommp41mp42',
 creation_time: '2024-02-14T01:21:12.000000Z'
 }
 },
 chapters: []
}



and here is from running
ffprobe
directly :

ffprobe '/Users/name/images/input.mp4'
ffprobe version 6.1.1 Copyright (c) 2007-2023 the FFmpeg developers
 built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
 libavutil 58. 29.100 / 58. 29.100
 libavcodec 60. 31.102 / 60. 31.102
 libavformat 60. 16.100 / 60. 16.100
 libavdevice 60. 3.100 / 60. 3.100
 libavfilter 9. 12.100 / 9. 12.100
 libswscale 7. 5.100 / 7. 5.100
 libswresample 4. 12.100 / 4. 12.100
 libpostproc 57. 3.100 / 57. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/name/images/input.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 1
 compatible_brands: isommp41mp42
 creation_time : 2024-02-14T01:21:12.000000Z
 Duration: 00:00:00.50, start: 0.000000, bitrate: 15319 kb/s
 Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1920, 5660 kb/s, 26.97 fps, 29.97 tbr, 30k tbn (default)
 Metadata:
 creation_time : 2024-02-14T01:21:12.000000Z
 handler_name : Core Media Video
 vendor_id : [0][0][0][0]
 encoder : AVC Coding
 Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 248 kb/s (default)
 Metadata:
 creation_time : 2024-02-14T01:21:12.000000Z
 handler_name : Core Media Audio
 vendor_id : [0][0][0][0]



And this is my command to go from video to frames :


ffmpeg -i /Users/name/images/input.mp4 -y -f image2 /Users/name/images/frames/%d.png



After which I convert the frames back to video with this - note that I get by seeing
avg_frame_rate
is27000/1001 = 26.97302697
:

ffmpeg -r 26.973026973026972 -i /Users/name/images/frames/%d.png -y -r 26.973026973026972 -b:v 5660223k -f mp4 -pix_fmt yuv420p -t 0.503333 /Users/name/images/output.mp4



And if I then run
fluent-ffmpeg
'sffmpeg.ffprobe(videoPath)
I get :

metadata {
 streams: [
 {
 index: 0,
 codec_name: 'h264',
 codec_long_name: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
 profile: 'High',
 codec_type: 'video',
 codec_tag_string: 'avc1',
 codec_tag: '0x31637661',
 width: 1080,
 height: 1920,
 coded_width: 1080,
 coded_height: 1920,
 closed_captions: 0,
 has_b_frames: 2,
 sample_aspect_ratio: '1:1',
 display_aspect_ratio: '9:16',
 pix_fmt: 'yuv420p',
 level: 62,
 color_range: 'unknown',
 color_space: 'unknown',
 color_transfer: 'unknown',
 color_primaries: 'unknown',
 chroma_location: 'left',
 field_order: 'unknown',
 refs: 1,
 is_avc: 'true',
 nal_length_size: 4,
 id: 'N/A',
 r_frame_rate: '27000/1001',
 avg_frame_rate: '27000/1001',
 time_base: '1/27000',
 start_pts: 0,
 start_time: 0,
 duration_ts: 14014,
 duration: 0.519037,
 bit_rate: 52138429,
 max_bit_rate: 'N/A',
 bits_per_raw_sample: 8,
 nb_frames: 14,
 nb_read_frames: 'N/A',
 nb_read_packets: 'N/A',
 tags: [Object],
 disposition: [Object]
 }
 ],
 format: {
 filename: '/Users/name/images/output.mp4',
 nb_streams: 1,
 nb_programs: 0,
 format_name: 'mov,mp4,m4a,3gp,3g2,mj2',
 format_long_name: 'QuickTime / MOV',
 start_time: 0,
 duration: 0.52,
 size: 3383708,
 bit_rate: 52057046,
 probe_score: 100,
 tags: {
 major_brand: 'isom',
 minor_version: '512',
 compatible_brands: 'isomiso2avc1mp41',
 encoder: 'Lavf60.3.100'
 }
 },
 chapters: []
}



and here is from running
ffprobe
directly :

ffprobe '/Users/name/images/output.mp4'
ffprobe version 6.1.1 Copyright (c) 2007-2023 the FFmpeg developers
 built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
 libavutil 58. 29.100 / 58. 29.100
 libavcodec 60. 31.102 / 60. 31.102
 libavformat 60. 16.100 / 60. 16.100
 libavdevice 60. 3.100 / 60. 3.100
 libavfilter 9. 12.100 / 9. 12.100
 libswscale 7. 5.100 / 7. 5.100
 libswresample 4. 12.100 / 4. 12.100
 libpostproc 57. 3.100 / 57. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/name/images/output.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf60.3.100
 Duration: 00:00:00.52, start: 0.000000, bitrate: 52153 kb/s
 Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1080x1920 [SAR 1:1 DAR 9:16], 52138 kb/s, 26.97 fps, 26.97 tbr, 27k tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc60.3.100 libx264



This seems like it should be a fairly common scenario, but I have not been able to find examples of this, and the other questions about incorrect durations on Stack Overflow are about bigger differences (i.e. 3 seconds instead of 10 seconds : Wrong video duration when recording with ffmpeg).


Some other details :


- 

- I am running this through a Node.js script with
fluent-ffmpeg
, but I have also tried running the commands directly in the terminal and the result is the same. - I am fine with the output frames being .png / .jpg / other formats.
- I am fine with setting this to a different frame rate than the original as long as the two output videos end up with the same duration.
- One suspicious thing is that I set
-t 0.503333
when creating the video, but it doesn't seem to work as the result video showsduration: 0.519037
/00:00:00.52
.










Thank you for any help !


- I am running this through a Node.js script with
-
6 Crucial Benefits of Conversion Rate Optimisation
26 février 2024, par Erin -
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 !