Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (76)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

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

  • Translating Return To Ringworld

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

    As indicated in my previous post, the Translator has expressed interest in applying his hobby towards another DOS adventure game from the mid 1990s : Return to Ringworld (henceforth R2RW) by Tsunami Media. This represents significantly more work than the previous outing, Phantasmagoria.


    Return to Ringworld Title Screen
    Return to Ringworld Title Screen

    I have been largely successful thus far in crafting translation tools. I have pushed the fruits of these labors to a Github repository named improved-spoon (named using Github’s random name generator because I wanted something more interesting than ‘game-hacking-tools’).

    Further, I have recorded everything I have learned about the game’s resource format (named RLB) at the XentaxWiki.

    New Challenges
    The previous project mostly involved scribbling subtitle text on an endless series of video files by leveraging a separate software library which took care of rendering fonts. In contrast, R2RW has at least 30k words of English text contained in various blocks which require translation. Further, the game encodes its own fonts (9 of them) which stubbornly refuse to be useful for rendering text in nearly any other language.

    Thus, the immediate 2 challenges are :

    1. Translating volumes of text to Spanish
    2. Expanding the fonts to represent Spanish characters

    Normally, “figuring out the file format data structures involved” is on the list as well. Thankfully, understanding the formats is not a huge challenge since the folks at the ScummVM project already did all the heavy lifting of reverse engineering the file formats.

    The Pitch
    Here was the plan :

    • Create a tool that can dump out the interesting data from the game’s master resource file.
    • Create a tool that can perform the elaborate file copy described in the previous post. The new file should be bit for bit compatible with the original file.
    • Modify the rewriting tool to repack some modified strings into the new resource file.
    • Unpack the fonts and figure out a way to add new characters.
    • Repack the new fonts into the resource file.
    • Repack message strings with Spanish characters.

    Showing The Work : Modifying Strings
    First, I created the tool to unpack blocks of message string resources. I elected to dump the strings to disk as JSON data since it’s easy to write and read JSON using Python, and it’s quick to check if any mistakes have crept in.

    The next step is to find a string to focus on. So I started the game and looked for the first string I could trigger :


    Return to Ringworld: Original text

    This shows up in the JSON string dump as :

      
        "Spanish" : " !0205Your quarters on the Lance of Truth are spartan, in accord with your mercenary lifestyle.",
        "English" : " !0205Your quarters on the Lance of Truth are spartan, in accord with your mercenary lifestyle."
      ,
    

    As you can see, many of the strings are encoded with an ID key as part of the string which should probably be left unmodified. I changed the Spanish string :

      
        "Spanish" : " !0205Hey, is this thing on ?",
        "English" : " !0205Your quarters on the Lance of Truth are spartan, in accord with your mercenary lifestyle."
      ,
    

    And then I wrote the repacking tool to substitute this message block for the original one. Look ! The engine liked it !


    Return to Ringworld: Modified text

    Little steps, little steps.

    Showing The Work : Modifying Fonts
    The next little step is to find a place to put the new characters. First, a problem definition : The immediate goal is to translate the game into Spanish. The current fonts encoded in the game resource only support 128 characters, corresponding to 7-bit ASCII. In order to properly express Spanish, 16 new characters are required : á, é, í, ó, ú, ü, ñ (each in upper and lower case for a total of 14 characters) as well as the inverted punctuation symbols : ¿, ¡.

    Again, ScummVM already documents (via code) the font coding format. So I quickly determined that each of the 9 fonts is comprised of 128 individual bitmaps with either 1 or 2 bits per pixel. I wrote a tool to unpack each character into an individual portable grey map (PGM) image. These can be edited with graphics editors or with text editors since they are just text files.

    Where to put the 16 new Spanish characters ? ASCII characters 1-31 are non-printable, so my first theory was that these characters would be empty and could be repurposed. However, after dumping and inspecting, I learned that they represent the same set of characters as seen in DOS Code Page 437. So that’s a no-go (so I assumed ; I didn’t check if any existing strings leveraged those characters).

    My next plan was hope that I could extend the font beyond index 127 and use positions 128-143. This worked superbly. This is the new example string :

      
        "Spanish" : " !0205¿Ves esto ? ¡La puntuacion se hace girar !",
        "English" : " !0205Your quarters on the Lance of Truth are spartan, in accord with your mercenary lifestyle."
      ,
    

    Fortunately, JSON understands UTF-8 and after mapping the 16 necessary characters down to the numeric range of 128-143, I repacked the new fonts and the new string :


    Return to Ringworld: Espanol
    Translation : “See this ? The punctuation is rotated !”

    Another victory. Notice that there are no diacritics in this string. None are required for this translation (according to Google Translate). But adding the diacritics to the 14 characters isn’t my department. My tool does help by prepopulating [aeiounAEIOUN] into the right positions to make editing easier for the Translator. But the tool does make the effort to rotate the punctuation since that is easy to automate.

    Next Steps and Residual Weirdness
    There is another method for storing ASCII text inside the R2RW resource called strip resources. These store conversation scripts. There are plenty of fields in the data structures that I don’t fully understand. So, following the lessons I learned from my previous translation outing, I was determined to modify as little as possible. This means copying over most of the original data structures intact, but changing the field representing the relative offset that points to the corresponding string. This works well since the strings are invariably stored NULL-terminated in a concatenated manner.

    I wanted to document for the record that the format that R2RW uses has some weirdness in they way it handles residual bytes in a resource. The variant of the resource format that R2RW uses requires every block to be aligned on a 16-byte boundary. If there is space between the logical end of the resource and the start of the next resource, there are random bytes in that space. This leads me to believe that these bytes were originally recorded from stale/uninitialized memory. This frustrates me because when I write the initial file copy tool which unpacks and repacks each block, I want the new file to be identical to the original. However, these apparent nonsense bytes at the end thwart that effort.

    But leaving those bytes as 0 produces an acceptable resource file.

    Text On Static Images
    There is one last resource type we are working on translating. There are various bits of text that are rendered as images. For example, from the intro :


    Return to Ringworld: Static text

    It’s possible to locate and extract the exact image that is overlaid on this scene, though without the colors :


    Original static text

    The palettes are stored in a separate resource type. So it seems the challenge is to figure out the palette in use for these frames and render a transparent image that uses the same palette, then repack the new text-image into the new resource file.

  • nodejs FFMPEG argument issues

    16 août 2016, par shaun

    When I put the following command in the command line FFMPEG works completely correct and mute’s the sections of the video as expected.

    C:\>ffmpeg -y -i C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4 -af "volume=enable='between(t,1,3)':volume=0, volume=enable='between(t,10,12)':volume=0, volume=enable='between(t,4,6)':volume=0, volume=enable='between(t,7,9)':volume=0" -c:v copy -movflags +faststart c:\temp\31e7ac4063d111e6bdc67f1f7f7b55d3.mp4
    ffmpeg version N-79651-ge1c2048 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.9.3 (GCC)
     configuration: --prefix=/usr/local/x86_64-w64-mingw32 --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --enable-runtime-cpudetect --enable-w32threads --disable-shared --disable-ffplay --disable-ffserver --arch=x86_64 --extra-cflags=-I/local/x86_64-w64-mingw32/include --extra-ldflags='-L/local/x86_64-w64-mingw32/lib -static'
     libavutil      55. 22.101 / 55. 22.101
     libavcodec     57. 38.100 / 57. 38.100
     libavformat    57. 34.103 / 57. 34.103
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 44.100 /  6. 44.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.34.103
     Duration: 00:00:12.78, start: 0.000000, bitrate: 4074 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 4006 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [mp4 @ 03a8e5e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
       Last message repeated 1 times
    Output #0, mp4, to 'c:\temp\31e7ac4063d111e6bdc67f1f7f7b55d3-AudRedact.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.34.103
       Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=2-31, 4006 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.38.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [mp4 @ 03a8e5e0] Starting second pass: moving the moov atom to the beginning of the file24.3x
    frame=  383 fps=0.0 q=-1.0 Lsize=    6325kB time=00:00:12.73 bitrate=4068.3kbits/s speed=24.7x
    video:6244kB audio:69kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.191899%
    [aac @ 03776160] Qavg: 51080.756

    However if I build the same in node programatically :

    function redactAudio(tempFilePath, arrPairs, cb){
       // ffmpeg -loglevel fatal -y -i video.mp4 -af "volume=enable='between(t,5,10)':volume=0, volume=enable='between(t,15,20)':volume=0" -c:v copy -movflags +faststart output.mp4

       var tempBuff = Buffer.alloc(16);
       jsuuid.v1(null, tempBuff, 0);
       var outFileName = tempBuff.toString('hex') + path2.extname(tempFilePath);

       var volStr = '"';
       for (var i = 0; i < arrPairs.length; i++) {
           volStr += "volume=enable='between(t," + arrPairs[i].start + "," + arrPairs[i].end + ")':volume=0";
           if (i !== arrPairs.length - 1) {
               volStr += ", ";
           } else {
               volStr += '"';
           }
       }

       child_process.execFile(
           'ffmpeg',
           [
               /*'-loglevel', 'fatal',*/
               '-y', '-i', tempFilePath,
               '-af', volStr,
               '-c:v', 'copy',
               '-movflags', '+faststart', outFileName
           ],
           {
               cwd: tempDir,
               maxBuffer: Infinity
           },
           function(err, stdout, stderr) {
               if (err) {
                   console.error(clc.magentaBright(clc.whiteBright('FFMPEG - ERROR OCC: ', path2.basename(tempFilePath), ' : ', stderr, '\n')));
                   return cb(err, 'FFMpeg Failed: ' +  JSON.stringify({ stdout: stdout, stderr: stderr} ));
               } else {
                   console.log(clc.magentaBright(clc.whiteBright('FFMPEG - Finished:  ', path2.basename(tempFilePath), '\n')));
                   return cb(null, outFileName);
               }
           }
       );  
    }

    Please Help me understand what is going on because I get the following error every time when run from node.

    FFMPEG - ERROR OCC:  0400028520160811144100001i100.mp4  :  ffmpeg version N-79651-ge1c2048 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.9.3 (GCC)
     configuration: --prefix=/usr/local/x86_64-w64-mingw32 --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --enable-runtime-cpudetect --enable-w32threads --disable-shared --disable-ffplay --disable-ffserver --arch=x86_64 --extra-cflags=-I/local/x86_64-w64-mingw32/include --extra-ldflags='-L/local/x86_64-w64-mingw32/lib -static'
     libavutil      55. 22.101 / 55. 22.101
     libavcodec     57. 38.100 / 57. 38.100
     libavformat    57. 34.103 / 57. 34.103
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 44.100 /  6. 44.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.34.103
     Duration: 00:00:12.78, start: 0.000000, bitrate: 4074 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 4006 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [AVFilterGraph @ 00381600] No such filter: '"volume'
    Error opening filters!

    0400028520160811144100001i100.mp4
    { Error: Command failed: ffmpeg -y -i C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4 -af "volume=enable='between(t,1,3)':volume=0, volume=enable='between(t,10,12)':volume=0, volume=enable='between(t,4,6)':volume=0, volume=enable='between(t,7,9)':volume=0" -c:v copy -movflags +faststart ea1eae2063d211e6bbf2af16c2e9be57.mp4
    ffmpeg version N-79651-ge1c2048 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.9.3 (GCC)
     configuration: --prefix=/usr/local/x86_64-w64-mingw32 --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --enable-runtime-cpudetect --enable-w32threads --disable-shared --disable-ffplay --disable-ffserver --arch=x86_64 --extra-cflags=-I/local/x86_64-w64-mingw32/include --extra-ldflags='-L/local/x86_64-w64-mingw32/lib -static'
     libavutil      55. 22.101 / 55. 22.101
     libavcodec     57. 38.100 / 57. 38.100
     libavformat    57. 34.103 / 57. 34.103
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 44.100 /  6. 44.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.34.103
     Duration: 00:00:12.78, start: 0.000000, bitrate: 4074 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 4006 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [AVFilterGraph @ 00381600] No such filter: '"volume'
    Error opening filters!

       at ChildProcess.exithandler (child_process.js:202:12)
       at emitTwo (events.js:106:13)
       at ChildProcess.emit (events.js:191:7)
       at maybeClose (internal/child_process.js:850:16)
       at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
     killed: false,
     code: 1,
     signal: null,
     cmd: 'ffmpeg -y -i C:/Users/ADMINI~1/AppData/Local/Temp/2/0400028520160811144100001i100.mp4 -af "volume=enable=\'between(t,1,3)\':volume=0, volume=enable=\'between(t,10,12)\':volume=0, volume=enable=\'between(t,4,6)\':volume=0, volume=enable=\'between(t,7,9)\':volume=0" -c:v copy -movflags +faststart ea1eae2063d211e6bbf2af16c2e9be57.mp4' }

    Best I can think is it has something to do with the \’ in volStr but I don’t know how to create it any other way.


    after @Mulvya comment I changed my for loop to

    var volStr = '';
    for (var i = 0; i < arrPairs.length; i++) {
       volStr += "volume=enable='between(t," + arrPairs[i].start + "," + arrPairs[i].end + ")':volume=0";
       if (i !== arrPairs.length - 1) {
           volStr += ",";
       }
    }

    getting rid of the space between each grouping and it worked beautifully.

  • Extract part of video with ffmpeg using datetime

    17 août 2016, par thecodeassassin

    Given a datetime from ffprobe :

    Metadata:
     rotate          : 90
     creation_time   : 2016-05-17 01:13:16
     handler_name    : VideoHandle

    I would like to select a part of the video between that date and another date for example 2016-05-17 01:23:16. Is this possible using ffmpeg ?