Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (37)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

  • ANNEXE : Les extensions, plugins SPIP des canaux

    11 février 2010, par

    Un plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
    Les extensions que MediaSPIP nécessite pour fonctionner
    Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
    Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...)

Sur d’autres sites (4957)

  • ffmpeg stream chrome kiosk mode ubuntu 16.04 server

    21 décembre 2016, par Raul

    I have a weird out-of-sync issue while using ffmpeg to stream to youtube live a chrome browser from an ub untu 16.04 server.

    Issue : output video streamed to youtube has audio/video out of sync, sometimes with as much as 3s

    Current flow :

    1) start pulseaudio - we using something like this to start it :

    pulseaudio --start -vvv --disallow-exit --log-target=syslog --high-priority --exit-idle-time=-1 --daemonize

    2) start Xvfb

    Xvfb :0 -ac -screen 0 1920x1080x24

    3) start chrome linux in kiosk mode

    google-chrome --kiosk --disable-gpu --incognito --no-first-run --disable-java --disable-plugins --disable-translate --disk-cache-size=$((1024 * 1024)) --disk-cache-dir=/tmp/chrome/ --user-data-dir=/tmp/chrome/ --force-device-scale-factor=1 --window-size=1920,1080 --window-position=0,0 LOCATION_URL

    4) start ffmpeg

    ffmpeg -y \
     -thread_queue_size 8192 -rtbufsize 250M -f x11grab -video_size 1920x1080 -framerate 24 -i :0 \
     -thread_queue_size 8192 -channel_layout stereo -f alsa -i pulse \
     -c:v libx264 -pix_fmt yuv420p -c:v libx264 -g 48 -crf 24 -filter:v fps=24 -preset ultrafast -tune zerolatency \
     -c:a aac -strict -2 -channel_layout stereo -ab 96k -ac 2 -flags +global_header \
     -f flv YOUTUBE_LIVE_STREAMING_RTMP

    Note : this is running on an amazon ec2 instance, meaning there is no soundcard, so alsa and pulseaudio are creating a dummy audio card. However, the latency does not come from there. Logs :

    Nov 25 06:14:22 ip-172-31-29-8 pulseaudio[26602]: [pulseaudio] protocol-native.c: Adjust latency mode enabled, configuring sink latency to half of overall latency.
    Nov 25 06:14:22 ip-172-31-29-8 pulseaudio[26602]: [pulseaudio] protocol-native.c: Requested latency=23.22 ms, Received latency=23.22 ms
    Nov 25 06:14:22 ip-172-31-29-8 pulseaudio[26602]: [pulseaudio] protocol-native.c: Final latency 69.66 ms = 23.22 ms + 2*11.61 ms + 23.22 ms

    At this point, here’s what we observed :

    1. if we start ffmpeg exactly after issuing the command to start chrome, we see the DTS errors from ffmpeg. Audio is out of sync with the video and has delay of 3-5seconds AHEAD. We also noticed the out of sync remains the same for the full duration of the stream

    2. if we start ffmpeg after around 10seconds, audio and video are almost in sync. We then manually added a -itsoffset -0.125 to the ffmpeg command and everything is perfect.

    Questions :

    1. Why would ffmpeg have so much lag if it’s started right after chrome ?
    2. Is starting the ffmpeg after 10s or X seconds the expected behavior ? That is, is this because the system needs to wait for audio/video signals to be "ready" or something ?
    3. Is there a way to 100% calculate or know when Chrome is fully ready and start ffmpeg ? We found sometimes it takes 5s, sometimes 10. Depends on the URL we load.
    4. Besides the DTS error that ffmpeg throws, is there any other way to know if audio/video is out-of-sync ? as sometimes we have a delay of between 0.5 to 1s, but ffmpeg does not report anything. And a restart is required to "re-balance" the audio/video inputs and get them back in sync.
    5. Can pulseaudio be the problem in this scenario ?

    Thank you

    UPDATE Dec 20

    We were able to do some tricks to force chrome to start the audio on page load, and that will force connect to pulseaudio. Doing that, plus adding a 3s delay for ffmpeg to start, there is no more delay when ffmpeg starts.
    However, our app is a webRTC app, and we have a STRANGER thing happening : if we start the page with no webcam/audio, once the webcam/audio is enabled, ffmpeg (while showing no errors) has a delay of 2s or so. While keep talking, in about max 30s, that delay is GONE.

    So the new questions are :

    1. Besides the DTS error that ffmpeg throws, is there any other way to know if audio/video is out-of-sync ? as sometimes we have a delay of between 0.5 to 1s, but ffmpeg does not report anything.
    2. What could cause the initial audio/video out of sync issue and then catching up ?
  • java.lang.NoClassDefFoundError : Could not initialize class on Linux (Works fine on Windows)

    26 décembre 2016, par Jake Miller

    I’m using a C++ FFmpeg wrapper for Java (org.bytedeco.javacpp). This works perfectly on a Windows machine (my development machine) but throws this error when ran on Linux (Amazon Web Services Elastic Beanstalk) :

    java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
       at java.lang.Class.forName0(Native Method) ~[na:1.8.0_111]
       at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_111]
       at org.bytedeco.javacpp.Loader.load(Loader.java:472) ~[javacpp-1.2.1.jar!/:1.2.1]
       at org.bytedeco.javacpp.Loader.load(Loader.java:417) ~[javacpp-1.2.1.jar!/:1.2.1]
       at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2819) ~[ffmpeg-3.2.1-1.3.jar!/:1.2.1]
       at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:391) ~[javacv-1.3.jar!/:1.3]
       at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:385) ~[javacv-1.3.jar!/:1.3]
    </clinit>

    I’ve been troubleshooting for the past 2 days and have tried the following to fix the issue :

    • upgrade to Linux to 2.4
    • downgrading javacpp to 1.2.1
    • running mvn clean
    • running mvn -U
    • deleting contents of /.m2/ and redownloading dependencies
    • various combinations of dependency versions
    • git clone on a Linux VM & running mvn install there

    When looking further into the issue, I stumbled upon documentation for avformat$AVFormatContext as it’s in the stack trace posted above (6th line). The documentation for a C++ class named AVFormatContext. Whenever I attempt to view the class in Eclipse, it says Source Not Found.

    My question : could this problem possibly be caused by the C++ libraries on my Linux VM ? None of the above solutions fixed it so this is my only hypothesis as of now.

    Here’s my other Stack Overflow question regarding this subject : Java.lang.NoClassDefFoundError caused by FFmpeg when deployed on Linux as a packaged .war (Works on development machine)

  • AWS Lambda subprocess OSError : [Errno 2] No such file or directory

    11 septembre 2016, par Lev

    I’m trying to create a lambda function that makes collection of thumbnails from a video on amazon s3 using ffmpeg. ffmpeg binary is included into fuction package.

    function code :

    # -*- coding: utf-8 -*-

    import stat
    import shutil
    import boto3
    import logging
    import subprocess as sp
    import os
    import threading

    thumbnail_prefix = 'thumb_'
    thumbnail_ext = '.jpg'
    time_delta = 1
    video_frames_path = 'media/videos/frames'

    print('Loading function')
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)

    lambda_tmp_dir = '/tmp'  # Lambda fuction can use this directory.

    # ffmpeg is stored with this script.
    # When executing ffmpeg, execute permission is requierd.
    # But Lambda source directory do not have permission to change it.
    # So move ffmpeg binary to `/tmp` and add permission.
    ffmpeg_bin = "{0}/ffmpeg.linux64".format(lambda_tmp_dir)
    shutil.copyfile('/var/task/ffmpeg.linux64', ffmpeg_bin)

    os.chmod(ffmpeg_bin, 777)

    # tried also:
    # os.chmod(ffmpeg_bin, os.stat(ffmpeg_bin).st_mode | stat.S_IEXEC)

    s3 = boto3.client('s3')


    def get_thumb_filename(num):
       return '{prefix}{num:03d}{ext}'.format(prefix=thumbnail_prefix, num=num, ext=thumbnail_ext)


    def create_thumbnails(video_url):
       i = 1
       filenames_list = []
       filename = None
       while i == 1 or os.path.isfile(os.path.join(os.getcwd(), get_thumb_filename(i-1))):
           if filename:
               filenames_list.append(filename)
           time = time_delta * (i - 1)
           filename = get_thumb_filename(i)
           print(ffmpeg_bin)
           if os.path.isfile(ffmpeg_bin):
               print('ok')
           sp.call(['sudo',
                    ffmpeg_bin,
                    '-ss',
                    str(time),
                    '-i',
                    video_url,
                    '-frames:v',
                    '1',
                    get_thumb_filename(i)])
           i += 1
       print(filenames_list)
       return filenames_list


    def s3_upload_file(file_path, key, bucket, acl, content_type):
       file = open(file_path, 'r')
       s3.put_object(
           Bucket=bucket,
           ACL=acl,
           Body=file,
           Key=key,
           ContentType=content_type
       )
       logger.info("file {0} moved to {1}/{2}".format(file_path, bucket, key))


    def s3_upload_files_in_threads(filenames_list, dir_path, bucket, s3path, acl, content_type):
       for filename in filenames_list:
           if os.path.isfile(os.path.join(dir_path, filename)):
               print(os.path.join(dir_path, filename))
           t = threading.Thread(target=s3_upload_file,
                                args=(os.path.join(dir_path, filename),
                                      '{0}/{1}'.format(s3path, filename),
                                      bucket,
                                      acl,
                                      content_type)).start()


    def lambda_handler(event, context):
       bucket = event['Records'][0]['s3']['bucket']['name']
       video_key = event['Records'][0]['s3']['object']['key']
       video_name = video_key.split('/')[-1].split('.')[0]
       video_url = 'http://{0}/{1}'.format(bucket, video_key)
       filenames_list = create_thumbnails(video_url)
       s3_upload_files_in_threads(filenames_list,
                                  os.getcwd(),
                                  bucket,
                                  '{0}/{1}'.format(video_frames_path, video_name),
                                  'public-read',
                                  'image/jpeg')
       return

    during the execution I get following logs :

    Loading function

    /tmp/ffmpeg.linux64

    ok

    [Errno 2] No such file or directory: OSError
    Traceback (most recent call last):
    File "/var/task/lambda_function.py", line 112, in lambda_handler
    filenames_list = create_thumbnails(video_url)
    File "/var/task/lambda_function.py", line 77, in create_thumbnails
    get_thumb_filename(i)])
    File "/usr/lib64/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
    File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
    File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
    OSError: [Errno 2] No such file or directory

    When I use the same sp.call() with the same ffmpeg binary on my ec2 instance it works fine.