Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (59)

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (8962)

  • How to get frames from HDR video in scRGB color space ?

    5 mars 2018, par Виталий Синявский

    I want to create a simple video player that will show HDR video on HDR TV. For example, this "LG Chess HDR" video. It is encoded with HEVC, its bit depth is 10 bit, pixel format is YUV420P10LE and it has metadata abount BT2020 color space and PQ transfer function.

    In this NVIDIA article I found the next :

    The display driver takes the scRGB back buffer, and converts it to the
    standard expected by the display presently connected. In general, this
    means converting the color space from sRGB primaries to BT. 2020
    primaries, scaling to an appropriate level, and encoding with a
    mechanism like PQ. Also, possibly performing conversions like RGB to
    YCC if that display connection requires it.

    It means that my player should render pixels in the scRGB color space (linear encoding, sRGB primaries, full range is -0.5 through just less than +7.5). So I need to get frames from the source video in this color space somehow, preferably in FP16 pixel format (half float, 16 bits per one color channel). I come to the following simple pipeline to render videos to HDR :

    source HDR video in BT2020 color space with applied PQ -> [some video library] ->
    -> video frames with colors in scRGB color space -> [my program] ->
    -> rendered video on HDR TV with applied conversions by display driver

    I’m trying to use FFmpeg as this library and do not understand how to get frames from the source HDR video in scRGB color space.

    I use sws_scale FFmpeg method now to get frames and know about filters API. But I did not found any information and help about how to transparantly get frames in scRGB using these functionality without parsing metadata for all source videos and create custom video filters for them.

    Please, tell me what I can do to get frames in the scRGB color space using FFmpeg. Can someone tell other libraries with which I can do it ?

  • What am I doing wrong ? Tweepy with ffmpeg

    27 août 2020, par pigeonburger

    I'm trying to get this code to pull the media from any tweet that mentions my twitter handle, convert it using ffmpeg via the subprocess module, then send the converted media back to the person as a reply ? Is this all correct ?


    I am also getting an error at tweet_media = clean_data['entities']['media']['media_url'] and I don't understand what I'm doing wrong there (Exception has occurred : TypeError
list indices must be integers or slices, not str
line 32, in on_data
tweet_media = clean_data['entities']['media']['media_url'])

    


    Also is there a better way to use ffmpeg with python that I am not aware of ?

    


    Here is the code I wrote that I'm trying to use :

    


    import tweepy
from tweepy import Stream
from tweepy.streaming import StreamListener
from datetime import datetime
import time
import subprocess

stdout = subprocess.PIPE
def runcmd(cmd):
    x = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    return x.communicate(stdout)

print(" TWITTER BOT")
time.sleep(1.5)
print(" By PigeonBurger, updated 26 August 2020 \n")

import json
import random

class StdOutListener(StreamListener):
    def on_data(self, data):
        clean_data = json.loads(data)
        tweetId = clean_data['id']
        tweet_name = clean_data['user']['screen_name']
        tweet_media = clean_data['entities']['media']['media_url']
        tweet_photo = runcmd('ffmpeg -i tweet_media output.jpg')
        print(clean_data)
        tweet = 'Here ya go'
        now = datetime.now()
        dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
        print(' Reply sent to @'+tweet_name, 'on', dt_string, '\n' ' Message:', tweet, '\n')
        respondToTweet(tweet_photo, tweet, tweetId)

def setUpAuth():
    auth = tweepy.OAuthHandler("consumer_key", "consumer_secret")
    auth.set_access_token("access_token", "access_token_secret")
    api = tweepy.API(auth)
    return api, auth

def followStream():
    api, auth = setUpAuth()
    listener = StdOutListener()
    stream = Stream(auth, listener)
    stream.filter(track=["@YOUR_TWITTER_HANDLE"], is_async=True)

def respondToTweet(tweet_photo, tweet, tweetId):
    api, auth = setUpAuth()
    api.update_with_media(tweet_photo, tweet, in_reply_to_status_id=tweetId, auto_populate_reply_metadata=True, stall_warnings=True)

if __name__ == "__main__":
    followStream()


    


  • ffmpeg stops capturing whole hour of HTTP stream after some time

    7 juillet 2020, par CompuChip

    First of all, sorry if I'm using the wrong terminology. I've been playing around with nginx and I'm still a bit confused about RTMP and HLS and other acronyms.

    


    I've managed to setup OBS to stream to an nginx server, which takes the RTMP stream and chops it into pieces for HLS. Here's the relevant part of the nginx configuration file.

    


    rtmp {
    server {
        listen 1935;
        chunk_size 4000;
        ping 30s;
        deny play all;

        application live {
            live on;
            hls on;
            hls_nested on; # Create a new folder for each stream
            hls_path /mnt/hls/live;
            hls_fragment 3s;
            hls_fragment_naming timestamp;
            hls_playlist_length 60s;
        }
    }
}

http {
    server {
        listen 81 ssl;

        #creates the http-location for our full-resolution (desktop) HLS stream - "http://localhost:8080/live/test/index.m3u8"
        location /live {
            # Elided caching and CORS for brevity

            alias /mnt/hls/live;
            add_header Cache-Control no-cache;
            index index.m3u8;
        }
    }
}


    


    This works well, I can view the stream in VLC or on a website and it looks smooth. Now I wanted to add some logging : I'd like to write full hours (starting at xx:00:00 and ending at xx:59:59) to a file named log_yyyymmdd_hh.mp4, e.g. log_20200707_18.mp4 for the files of 7 July 2020, 18:00 - 19:00 hrs. So I've set up an hourly cron job with the following ffmpeg command :

    


    ffmpeg -i https://stream.example.com:81/live/<streamkey> -preset veryfast -maxrate 2000k \&#xA;    -bufsize 2000k -g 60 -t 3600 -y /var/video/log/$(date &#x2B;\%Y\%m\%d_\%H00).mp4 >/dev/null 2>&amp;1&#xA;</streamkey>

    &#xA;

    At first this seemed to work well, so I left it running happily for about 24 hours. When I checked, most of my hourly files were small ( 100MB) files of about 10 to 15 minutes long. It seems like any small delay in the stream will cause ffmpeg to stop writing to the file. I suspect such hiccups may for example be caused by an OBS plugin and I'll need to look into that, but I would prefer that ffmpeg will retry for some time before giving up. What arguments should I be passing to ffmpeg to make it not break when the stream is down for, say, up to a second every now and then ?.

    &#xA;

    When I view back the HLS files there don't seem to be any noticeable gaps, so eventually all the data arrives. I went for the crontab solution with ffmpeg because when recording from nginx I could not figure out how to start recording at the start of the whole hour.

    &#xA;