Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (102)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP 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" (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Contribute to translation

    13 avril 2011

    You 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 (...)

Sur d’autres sites (6431)

  • 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 ?
  • 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.

    


  • 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)