Recherche avancée

Médias (91)

Autres articles (83)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (14530)

  • Variable fps (frame per second) in cv2

    17 octobre 2022, par Sepide

    I use cv2 for creating videos from different frames that I have. When I create the video, I cannot change the fps (frame per second). I want the video be slow at the beginning but fast towards the end, meaning small fps at the beginning but large ones towards the end. However, when I instantiate cv2.VideoWriter I cannot change the fps anymore. What should I do ?

    


    Replicable code

    


    import numpy as np
import cv2, os
import matplotlib

image_size = 200
def create_image_array(image_size):
  image_array = np.random.randn(image_size, image_size)
  row = np.random.randint(0, image_size)
  image_array[row, :] = 100
  return image_array

frame_numbers = 200
for i in range(frame_numbers):
  image_array = create_image_array(image_size)
  matplotlib.image.imsave(f'./shots/frame_{i:03d}.png', image_array)

def make_a_video(shots_folder, video_path):

    shots_folder = 'shots'
    fps = 25
    images = [img for img in os.listdir(shots_folder) if img.endswith(".png")]

    images = sorted(images)[:]
    frame = cv2.imread(os.path.join(shots_folder, images[0]))
    height, width, layers = frame.shape

    video = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (width, height))

    for image in images:
        video.write(cv2.imread(os.path.join(shots_folder, image)))

    cv2.destroyAllWindows()
    video.release()

shots_folder = 'shots'
video_path = 'video.mp4'  
make_a_video(shots_folder, video_path)


    


  • How to create a local audio livestream server with ffmpeg and python ? [closed]

    10 novembre 2024, par Fenekhu

    Simply put, this is what I'm trying to accomplish :
    
I navigate to something like http://localhost:8080/ in my browser and the browser shows a built-in audio player playing whatever the ffmpeg process is streaming. (Not just serving a local audio file.) (Built-in here meaning the page looks the same as if you had opened an mp3 file with your browser.)

    


    At first I thought it would be easy, as ffmpeg has the ability to stream through different protocols. I seem to have misunderstood though, because while I can stream something over rtp with it, I can't access that from my browser. Some stackoverflow questions I found seem to imply that you can do this with the output options -f mpegts http://localhost:8080, but when I try this, ffmpeg freezes for a second, then I get these errors :

    


    [tcp @ 00000210f70b0700] Connection to tcp://localhost:8080 failed: Error number -138 occurred
[out#0/mpegts @ 00000210f7080ec0] Error opening output http://localhost:8080: Error number -138 occurred
Error opening output file http://localhost:8080.
Error opening output files: Error number -138 occurred


    


    but I have no problem with -f rtp rtp://localhost:8080. (Like I said though, I can't access that through the browser).

    


    So I suspect I need something else to "pick up" the rtp stream and put it on an http server, but I haven't been able to find anything on that, probably because I just don't know the right thing to search. It seems like something that should be easily doable in Python, and that would be my preferred language to do it in over javascript, if possible.

    


    Can anyone point me in the right direction ? Or let me know if I'm misunderstanding something ? Thanks.

    


  • Understanding PTS and DTS in video frames

    28 juin 2017, par theateist

    I had fps issues when transcoding from avi to mp4(x264). Eventually the problem was in PTS and DTS values, so lines 12-15 where added before av_interleaved_write_frame function :

    1.  AVFormatContext* outContainer = NULL;
    2.  avformat_alloc_output_context2(&outContainer, NULL, "mp4", "c:\\test.mp4";
    3.  AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
    4.  AVStream *outStream = avformat_new_stream(outContainer, encoder);
    5.  // outStream->codec initiation
    6.  // ...
    7.  avformat_write_header(outContainer, NULL);

    8.  // reading and decoding packet
    9.  // ...
    10. avcodec_encode_video2(outStream->codec, &encodedPacket, decodedFrame, &got_frame)
    11.
    12. if (encodedPacket.pts != AV_NOPTS_VALUE)
    13.     encodedPacket.pts =  av_rescale_q(encodedPacket.pts, outStream->codec->time_base, outStream->time_base);
    14. if (encodedPacket.dts != AV_NOPTS_VALUE)
    15.     encodedPacket.dts = av_rescale_q(encodedPacket.dts, outStream->codec->time_base, outStream->time_base);
    16.
    17. av_interleaved_write_frame(outContainer, &encodedPacket)

    After reading many posts I still do not understand :

    1. outStream->codec->time_base = 1/25 and outStream->time_base = 1/12800. The 1st one was set by me but I cannot figure out why and who set 12800 ? I noticed that before line (7) outStream->time_base = 1/90000 and right after it it changes to 1/12800, why ?
      When I transcode from avi to avi, meaning changing the line (2) to avformat_alloc_output_context2(&outContainer, NULL, "avi", "c:\\test.avi"; , so before and after line (7) outStream->time_base remains always 1/25 and not like in mp4 case, why ?
    2. What is the difference between time_base of outStream->codec and outStream ?
    3. To calc the pts av_rescale_q does : takes 2 time_base, multiplies their fractions in cross and then compute the pts. Why it does this in this way ? As I debugged, the encodedPacket.pts has value incremental by 1, so why changing it if it does has value ?
    4. At the beginning the dts value is -2 and after each rescaling it still has negative number, but despite this the video played correctly ! Shouldn’t it be positive ?