Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (66)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (9824)

  • Trying to load a .mp4 Video fails using open CV

    19 février 2017, par Ichor de Dionysos

    I’ve installed ffmpeg and opencv on my linux server, like that :

    git clone
    cd FFmpeg
    ./configure --enable-shared
    make
    sudo make install

    sudo apt-get install build-essential
    sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

    git clone
    cmake <path to="" the="" opencv="" source="" directory="">
    mkdir release
    cd release
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
    make
    sudo make install
    </path>

    I wrote a little Python script :

    import cv2
    cap = cv2.VideoCapture('video.mp4')
    total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

    But I’m not able to load that video and total_frames are always 0.

    I did some research why this doesn’t work and found tons of answers tried so many ways to install it, but it didn’t work for me.

    What did I do wrong ? Am I missing some detail ?

    I’m really annoyed and from installing it

    EDIT :

    When cmake opencv, it shows me this :

    --   Video I/O:                                                              
    --     DC1394 1.x:                  NO                                      
    --     DC1394 2.x:                  YES (ver 2.2.1)                          
    --     FFMPEG:                      YES                                      
    --       avcodec:                   YES (ver 57.80.101)                      
    --       avformat:                  YES (ver 57.66.102)                      
    --       avutil:                    YES (ver 55.47.100)                      
    --       swscale:                   YES (ver 4.3.101)                        
    --       avresample:                YES (ver 1.0.1)                          
    --     GStreamer:                   NO                                      
    --     OpenNI:                      NO                                      
    --     OpenNI PrimeSensor Modules:  NO                                      
    --     OpenNI2:                     NO                                      
    --     PvAPI:                       NO                                      
    --     GigEVisionSDK:               NO                                      
    --     Aravis SDK:                  NO                                      
    --     UniCap:                      NO                                      
    --     UniCap ucil:                 NO                                      
    --     V4L/V4L2:                    NO/YES                                  
    --     XIMEA:                       NO                                      
    --     Xine:                        NO                                      
    --     gPhoto2:                     NO

    So ffmpeg should be usable, right ?

    EDIT 2 :

    After reinstall on a fresh new VM I get this error :

    [mp3 @ 0x1dbb2a0] Header missing
    [mp3 @ 0x1dbb2a0] Header missing
    Unable to stop the stream: Inappropriate ioctl for device
    (python:17171): GLib-GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)' failed
  • Approaches To Modifying Game Resource Files

    16 août 2016, par Multimedia Mike — Game Hacking

    I have been assisting The Translator in the translation of another mid-1990s adventure game. This one isn’t quite as multimedia-heavy as the last title, and the challenges are a bit different. I wanted to compose this post in order to describe my thought process and mental model in approaching this problem. Hopefully, this will help some others understand my approach since what I’m doing here often appears as magic to some of my correspondents.

    High Level Model
    At the highest level, it is valuable to understand the code and the data at play. The code is the game’s engine and the data refers to the collection of resources that comprise the game’s graphics, sound, text, and other assets.


    High-level game engine model
    Simplistic high-level game engine model

    Ideally, we want to change the data in such a way that the original game engine adopts it as its own because it has the same format as the original data. It is very undesirable to have to modify the binary engine executable in any way.

    Modifying The Game Data Directly
    How to modify the data ? If we modify the text strings for the sake of language translation, one approach might be to search for strings within the game data files and change them directly. This model assumes that the text strings are stored in a plain, uncompressed format. Some games might store these strings in a text format which can be easily edited with any text editor. Other games will store them as binary data.

    In the latter situation, a game hacker can scan through data files with utilities like Unix ‘strings’ to find the resources with the desired strings. Then, use a hex editor to edit the strings directly. For example, change “Original String”…

    0098F800   00 00 00 00  00 00 00 4F  72 69 67 69  6E 61 6C 20  .......Original 
    0098F810   53 74 72 69  6E 67 00 00  00 00 00 00  00 00 00 00  String..........
    

    …to “Short String” and pad the difference in string lengths using spaces (0x20) :

    0098F800   00 00 00 00  00 00 00 53  68 6F 72 74  20 53 74 72  .......Short Str
    0098F810   69 6E 67 20  20 20 00 00  00 00 00 00  00 00 00 00  ing   ..........
    

    This has some obvious problems. First, translated strings need to be of equal our smaller length compared to the original. What if we want to encode “Much Longer String” ?

    0098F800   00 00 00 00  00 00 00 4D  75 63 68 20  4C 6F 6E 67  .......Much Long
    0098F810   65 72 20 53  74 72 00 00  00 00 00 00  00 00 00 00  er Str..........
    

    It won’t fit. The second problem pertains to character set limitations. If the font in use was only designed for ASCII, it’s going to be inadequate for expressing nearly any other language.

    So a better approach is needed.

    Understanding The Data Structures
    An alternative to the approach outlined above is to understand the game’s resources so they can be modified at a deeper level. Here’s a model to motivate this investigation :


    Model of the game resource archive model
    Model of the game resource archive format

    This is a very common layout for such formats : there is a file header, a sequence of resource blocks, and a trailing index which describes the locations and types of the foregoing blocks.

    What use is understanding the data structures ? In doing so, it becomes possible to write new utilities that disassemble the data into individual pieces, modify the necessary pieces, and then reassemble them into a form that the original game engine likes.

    It’s important to take a careful, experimental approach to this since mistakes can be ruthlessly difficult to debug (unless you relish the thought of debugging the control flow through an opaque DOS executable). Thus, the very first goal in all of this is to create a program that can disassemble and reassemble the resource, thus creating an identical resource file. This diagram illustrates this complex initial process :


    Rewriting the game resource file
    Rewriting the game resource file

    So, yeah, this is one of the most complicated “copy file” operations that I can possibly code. But it forms an important basis, since the next step is to carefully replace one piece at a time.


    Modifying a specific game resource
    Modifying a specific game resource

    This diagram shows a simplistic model of a resource block that contains a series of message strings. The header contains pointers to each of the strings within the block. Instead of copying this particular resource block directly to the new file, a proposed modification utility will intercept it and rewrite the entire thing, writing new strings of arbitrary length and creating an adjusted header which will correctly point to the start of each new string. Thus, translated strings can be longer than the original strings.

    Further Work
    Exploiting this same approach, we can intercept and modify other game resources including fonts, images, and anything else that might need to be translated. I will explore specific examples in a later blog post.

    Followup

    The post Approaches To Modifying Game Resource Files first appeared on Breaking Eggs And Making Omelettes.

  • Playing Live Audio Stream in HTML5 - MediaSource Errors in Chrome

    18 octobre 2016, par user882807

    I need a way to play a live audio stream using HTML5 (primarily in Google Chrome), so I tried using the following :

    <audio>
       <source src="my-live-stream.ogg" type="audio/ogg">
    </source></audio>

    While this does work for a live stream, there seems to be a very large, uncontrollable delay/buffer of around 30 seconds or so when this is played.

    I need the delay to be a couple of seconds or less so this method doesn’t work.

    As an alternative I have tried sending the audio over a WebSocket connection as 1 second individual audio files, which are then appended to a SourceBuffer and played in an audio element using Media Source Extensions.

    After experimenting with a number of formats (MediaSource.isTypeSupported seems to be rather limited in audio support), I got this working using a Vorbis audio stream in a WebM container, which sounds perfect with no audible gaps. Other formats worked less well as they need to be gapless - e.g. MP3 and AAC end up with tiny audible gaps between each 1 second segment.

    While this seems to work at first, when looking at chrome://media-internals, the following errors repeatedly appear :

    00:00:09 544    info    Estimating WebM block duration to be 3ms for the last (Simple)Block in the Cluster for this Track. Use BlockGroups with BlockDurations at the end of each Track in a Cluster to avoid estimation.
    00:00:09 585    error   Large timestamp gap detected; may cause AV sync to drift. time:8994999us expected:9231000us delta:-236001us
    00:01:05 239    debug   Skipping splice frame generation: not enough samples for splicing new buffer at 65077997us. Have 1us, but need 1000us.

    Eventually the playback stops as though the pause button has been pressed on the audio element. It still shows the pause rather than play button, but the current time stops advancing :

    Audio element

    Pressing the pause button and then the play button that replaces it doesn’t make it start playing again, but manually dragging the position slider further ahead makes it continue playing.

    I have tried setting sourceBuffer.mode = 'sequence'; but this doesn’t seem to help.

    Is there anything that needs to be changed in how the audio files are being encoded, or how they are played back in JavaScript to fix this ?


    Additional details :

    1. The audio stream is encoded into 1 second WebM/Vorbis files using FFmpeg on Windows.
    2. A background worker is used in the browser to receive the audio segments and pass them to the main page thread, which appends them to the audio stream. Otherwise the playback freezes.

    Source code :