Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (95)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (8926)

  • How do I combine PyTube audio and video streams in a Flask app and let the user download as one file without storing on the web server ?

    10 avril 2022, par AJB9384

    I'm building a YouTube downloader as a side project in Flask. It allows users to input a url and download the video without storing anything on the server I'm hosting on

    


    Lower quality videos can be sent to the user easily as they from PyTube as one file. I use the code below :

    


    import os
import flask
from flask import redirect, url_for, session, send_file
import requests

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
  buffer=BytesIO()
  yt_test=YouTube('https://www.youtube.com/watch?v=NNNPgIfK2YE')
  video = yt_test.streams.get_by_itag(251)

  video.stream_to_buffer(buffer)
  buffer.seek(0)

  return send_file(buffer, as_attachment=True, download_name="Test video")


    


    However, I struggle when trying to pull in higher quality videos as they come in as separate audio and videos streams (see documentation here : https://pytube.io/en/latest/user/streams.html#)

    


    I am trying to use ffmpeg to combine the two and then send to the user, but the code below isn't working as expected and throws an error :

    


    Code :

    


    import os
import flask
from flask import redirect, url_for, session, send_file
import requests
import ffmpeg

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
  buffer=BytesIO()
  
  video = yt_test.streams.get_by_itag(137)
  input_video = ffmpeg.input(video)
  
  audio = yt_test.streams.get_by_itag(137)
  input_audio = ffmpeg.input(audio)
  
  combined = ffmpeg.concat(input_video, input_audio, v=1, a=1)
  combined.stream_to_buffer(buffer)
  buffer.seek(0)

  return send_file(buffer, as_attachment=True, download_name="Test video")


    


    Error : AttributeError : 'FilterableStream' object has no attribute 'stream_to_buffer'

    


    How could I combine these audio and video streams from PyTube into one file for the user to download without storing on the server ?

    


  • Shazamio throws an error when running the code

    26 août 2023, par steilzz.

    I tried this code :

    


    import asyncio
from shazamio import Shazam
import ffprobe

async def main():
  shazam = Shazam()
  out = await shazam.recognize_song('Fluxxwave.m4a')
  print(out)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())


    


    but I got an error :

    


      File "/Users/nikitamakarov/PycharmProjects/shazamMy/venv/lib/python3.10/site-packages/ffprobe/ffprobe.py", line 12, in <module>&#xA;    from ffprobe.exceptions import FFProbeError&#xA;  File "/Users/nikitamakarov/PycharmProjects/shazamMy/venv/lib/python3.10/site-packages/ffprobe/ffprobe.py", line 12, in <module>&#xA;    from ffprobe.exceptions import FFProbeError&#xA;ModuleNotFoundError: No module named &#x27;ffprobe.exceptions&#x27;; &#x27;ffprobe&#x27; is not a package&#xA;</module></module>

    &#xA;

    The package is definitely installed, so why does this happen ?

    &#xA;

  • create a movie in python [on hold]

    22 mai 2017, par masoud

    I have some files with names (’Den_car_resample’ +’sdf’+ str(n)+’.dat’) where n changes from 0 to 25. I wrote a code to read these files and plots the results.
    now I want to create a movie from these plots. at the end of the program, I used the avconv command to do that.
    but, unfortunately my code creates a movie but it is empty.
    I don’t know the reason exactly but I think, first, I have to define a frame to each plot and then create a movie.
    can anyone please tell me how can I define a frame and also the add bit_rate of the movie.

    import sys
    import subprocess  
    import sdf
    import numpy as np
    import matplotlib.pyplot as plt  
    import time
    import matplotlib.animation as Animation
    from matplotlib.font_manager import FontProperties
    fp = FontProperties('Symbola')

    ##################### information from EPOCH input.deck
    nx,ny= 1200, 1600
    xmin=-100e-6
    xmax = 110e-6
    ymin = -200e-6
    ymax = 200e-6
    X =np.linspace(xmin,xmax,nx)  
    Y =np.linspace(ymin,ymax,ny)

    #################
    for n in range(0,25):
     nstr = str(n)

    ######################..... reading Density of carbon
     filename ="Den_car_resample" +'_sdf_'+ str(n)+'.dat'

     with open(filename, 'rb') as f:                        
       data = np.fromfile(f, dtype='float64', count=nx*ny)  

     Den_car  = np.reshape(data, [ny, nx], order='F')
     Den_car= np.log10(Den_car)

     ######################  Display Carbon density

     fig = plt.imshow(Den_car,  extent=[X.min()*1e6, X.max()*1e6, Y.min()*1e6,Y.max()*1e6], vmin=24, vmax=29, cmap='brg', aspect='auto')
     plt.suptitle('Den_car')
     plt.title('sdf '+ str(n)+'; Time= '+str(n*50)+'ps',color='green', fontsize=15)
     plt.xlabel('x($\mu$m)')
     plt.ylabel('y($\mu$m)')
     plt.text(-80,-40,'Den_Carbon',color='red', fontsize=15)
     plt.colorbar()
     plt.savefig( 'fig%06d.png' % n, bbox_inches='tight')          

     plt.pause(.1)
     plt.clf()  
     plt.close()

     ######################  Create movie

     subprocess.call("avconv -framerate 1 -i fig%06d.png -c:v libx264 -profile:v high -crf 20".split())

    sys.exit()