Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (12)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

Sur d’autres sites (3970)

  • Combine Audio and Images in Stream

    19 décembre 2017, par SenorContento

    I would like to be able to create images on the fly and also create audio on the fly too and be able to combine them together into an rtmp stream (for Twitch or YouTube). The goal is to accomplish this in Python 3 as that is the language my bot is written in. Bonus points for not having to save to disk.

    So far, I have figured out how to stream to rtmp servers using ffmpeg by loading a PNG image and playing it on loop as well as loading a mp3 and then combining them together in the stream. The problem is I have to load at least one of them from file.

    I know I can use Moviepy to create videos, but I cannot figure out whether or not I can stream the video from Moviepy to ffmpeg or directly to rtmp. I think that I have to generate a lot of really short clips and send them, but I want to know if there’s an existing solution.

    There’s also OpenCV which I hear can stream to rtmp, but cannot handle audio.

    A redacted version of an ffmpeg command I have successfully tested with is

    ffmpeg -loop 1 -framerate 15 -i ScreenRover.png -i "Song-Stereo.mp3" -c:v libx264 -preset fast -pix_fmt yuv420p -threads 0 -f flv rtmp://SITE-SUCH-AS-TWITCH/.../STREAM-KEY

    or

    cat Song-Stereo.mp3 | ffmpeg -loop 1 -framerate 15 -i ScreenRover.png -i - -c:v libx264 -preset fast -pix_fmt yuv420p -threads 0 -f flv rtmp://SITE-SUCH-AS-TWITCH/.../STREAM-KEY

    I know these commands are not set up properly for smooth streaming, the result manages to screw up both Twitch’s and Youtube’s player and I will have to figure out how to fix that.

    The problem with this is I don’t think I can stream both the image and the audio at once when creating them on the spot. I have to load one of them from the hard drive. This becomes a problem when trying to react to a command or user chat or anything else that requires live reactions. I also do not want to destroy my hard drive by constantly saving to it.

    As for the python code, what I have tried so far in order to create a video is the following code. This still saves to the HD and is not responsive in realtime, so this is not very useful to me. The video itself is okay, with the one exception that as time passes on, the clock the qr code says versus the video’s clock start to spread apart farther and farther as the video gets closer to the end. I can work around that limitation if it shows up while live streaming.

    def make_frame(t):
     img = qrcode.make("Hello! The second is %s!" % t)
     return numpy.array(img.convert("RGB"))

    clip = mpy.VideoClip(make_frame, duration=120)
    clip.write_gif("test.gif",fps=15)

    gifclip = mpy.VideoFileClip("test.gif")
    gifclip.set_duration(120).write_videofile("test.mp4",fps=15)

    My goal is to be able to produce something along the psuedo-code of

    original_video = qrcode_generator("I don't know, a clock, pyotp, today's news sources, just anything that can be generated on the fly!")
    original_video.overlay_text(0,0,"This is some sample text, the left two are coordinates, the right three are font, size, and color", Times_New_Roman, 12, Blue)
    original_video.add_audio(sine_wave_generator(0,180,2)) # frequency min-max, seconds

    # NOTICE - I did not add any time measurements to the actual video itself. The whole point is this is a live stream and not a video clip, so the time frame would be now. The 2 seconds list above is for our psuedo sine wave generator to know how long the audio clip should be, not for the actual streaming library.

    stream.send_to_rtmp_server(original_video) # Doesn't matter if ffmpeg or some native library

    The above example is what I am looking for in terms of video creation in Python and then streaming. I am not trying to create a clip and then stream it later, I am trying to have the program be able to respond to outside events and then update it’s stream to do whatever it wants. It is sort of like a chat bot, but with video instead of text.

    def track_movement(...):
     ...
     return ...

    original_video = user_submitted_clip(chat.lastVideoMessage)
    original_video.overlay_text(0,0,"The robot watches the user's movements and puts a blue square around it.", Times_New_Roman, 12, Blue)
    original_video.add_audio(sine_wave_generator(0,180,2)) # frequency min-max, seconds

    # It would be awesome if I could also figure out how to perform advance actions such as tracking movements or pulling a face out of a clip and then applying effects to it on the fly. I know OpenCV can track movements and I hear that it can work with streams, but I cannot figure out how that works. Any help would be appreciated! Thanks!

    Because I forgot to add the imports, here are some useful imports I have in my file !

    import pyotp
    import qrcode
    from io import BytesIO
    from moviepy import editor as mpy

    The library, pyotp, is for generating one time pad authenticator codes, qrcode is for the qr codes, BytesIO is used for virtual files, and moviepy is what I used to generate the GIF and MP4. I believe BytesIO might be useful for piping data to the streaming service, but how that happens, depends entirely on how data is sent to the service, whether it be ffmpeg over command line (from subprocess import Popen, PIPE) or it be a native library.

  • ffmpeg output to stdout is a black box (python)

    27 juillet 2022, par dwilliams

    Project Background :
The project I'm working on takes an image from a UE simulation camera, uses OpenCV to convert the image to .jpg, and streams the .jpg to a localhost port so that a second program can retrieve the images and annotate the objects in the simulation. I am attempting to convert these to a suitable format for UE4's WmfMediaPlayer via ffmpeg so that it can be streamed to another localhost port.

    


    Problem :
I have managed to get a the stream active but the video at the end of stream is a black square. I'm confident but not 100% certain that I've setup the ffmpeg correctly. The output to console seem to imply that the conversion is working but I've been fooled before. It could also be the flask yield component.

    


    ffmpeg declaration/setup :

    


    process = (
        ffmpeg
        .input('C:/MOT/test.jpg')   
        .output('pipe:1', vcodec='libx264', format='avi')   
        .overwrite_output()
        .run_async(pipe_stdin=True, pipe_stdout=True)
    )


    


    Flask Integration :

    


    @app.route('/annotated')
def annotated():
    return Response(
        frame_generator_annotated(),
        mimetype='multipart/x-mixed-replace; boundary=frame'
    )


def frame_generator_annotated():
    global process
    while (True):
        frame = process.stdout.read()
        yield (b'--frame\r\n'
               b'Content-Type: video/avi\r\n\r\n' + frame + b'\r\n\r\n')


    


    stream view :
http://localhost:5001/annotated

    


    ffmpeg console output :

    


    Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.220:5001/ (Press CTRL+C to quit)
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.1 (GCC) 20200726
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[mjpeg @ 00000269be0faec0] EOI missing, emulating
Input #0, image2, from 'C:/MOT/test.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1968 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1024x576 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 00000269be0fc240] using SAR=1/1
[libx264 @ 00000269be0fc240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000269be0fc240] profile High, level 3.1, 4:2:0, 8-bit
Output #0, avi, to 'pipe:1':
  Metadata:
    ISFT            : Lavf58.45.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 1024x576 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=28.0 Lsize=       2kB time=00:00:00.04 bitrate= 447.2kbits/s speed= 2.9x    
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 157.307251%
[libx264 @ 00000269be0fc240] frame I:1     Avg QP:13.00  size:   869
[libx264 @ 00000269be0fc240] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 00000269be0fc240] 8x8 transform intra:0.0%
[libx264 @ 00000269be0fc240] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[libx264 @ 00000269be0fc240] i16 v,h,dc,p: 97%  0%  3%  0%
[libx264 @ 00000269be0fc240] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 00000269be0fc240] kb/s:173.80


    


  • French CNIL recommends Piwik : the only analytics tool that does not require Cookie Consent

    29 octobre 2014, par Matthieu Aubry — Press Releases

    There has been recent and important changes in France regarding data privacy and the use of cookies. This blog post will introduce you to these changes and explain how you make your website compliant.

    Cookie Consent in the data freedom law

    Since the adoption of the EU Directive 2009/136/EC “Telecom Package”, Internet users must be informed and provide their prior consent to the storage of cookies on their computer. The use of cookies for advertising, analytics and social share buttons require the user’s consent :

    It is necessary to inform users of the presence, purpose and duration of the cookies placed in their browsers, and the means at their disposal to oppose it.

    What is a cookie ?

    Cookies are tracers placed on Internet users’ hard drives by the web hosts of the visited website. They allow the website to identify a single user across multiple visits with a unique identifier. Cookies may be used for various purposes : building up a shopping cart, storing a website’s language settings, or targeting advertising by monitoring the user’s web-browsing.

    Which cookies are exempt from the Cookie Consent rule ?

    France has exempted certain cookies from the cookie consent rule : for those cookies that are strictly necessary to offer the service sought after by the user you do not need to ask consent to user. Examples of such cookies are :

    • the shopping cart cookie,
    • authentication cookies,
    • short lived session cookies,
    • load balancer cookies,
    • certain first party analytics (such as Piwik cookies),
    • persistent cookies for interface personalisation.

    Asking users for consent for Analytics (tracking) Cookies

    For all cookies that are not exempted from the Cookie Consent then you will need to :

    • obtain consent from web users before placing or reading cookies and similar technologies,
    • clearly inform web users of the different purposes for which the cookies and similar technologies will be used,
    • propose a real choice to web users between accepting or refusing cookies and similar technologies.

    You don’t need Cookie Consent with Piwik

    The excellent news is that there is a way to bypass the Cookie Consent banner on your website :

    If you are using another analytics solution other than Piwik then you will need to ask users for consent. If you do not want to ask for consent then download and install Piwik or signup to Piwik Cloud to get started.

    If you are already using Piwik you need to do two simple things : (1) anonymise visitor IP addresses (at least two bytes) and (2) include the opt-out iframe solution in your website (learn more).

    Note that these recommendations currently only apply in France, but because the law is European we can expect similar findings in other European countries.

    CNIL recommends Piwik

    We are proud that the CNIL has identified Piwik as the only tool that respects all privacy requirements set by the European Telecom law.

    About the CNIL

    The CNIL is an independent administrative body that operates in accordance with the French data protection legislation. The CNIL has been entrusted with the general duty to inform people of the rights that the data protection legislation allows them.

    The role and responsabilities of the CNIL are :

    • to protect citizens and their data
    • to regulate and control processing of personal data
    • to inspect the security of data processing systems and applications, and impose penalties

    Piwik and Privacy

    At Piwik we love Privacy – our open analytics platform comes with built-in Privacy.

    Future of Privacy at Piwik

    Piwik is already the leader when it comes to respecting user privacy but we plan to continue improving privacy within the open analytics platform. For more information and specific ideas see Privacy enhancing issues in our issue tracker.

    References

    Learn more in these articles in French [fr] or English :

    Contact

    To learn more about Piwik, please visit piwik.org,

    Get in touch with the Piwik team : Contact information,

    For professional support contact Piwik PRO.