Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (90)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (8637)

  • Delayed::Job ffmpeg hangs when processing large files using delayed_paperclip

    11 septembre 2016, par Noah Passalacqua

    I am trying to use delayed_job to process large videos and audio files in the background. For the most part everything works. The only time it runs into any hiccups is when larger files are uploaded ( >200MB)

    app/models/userfile.rb

    has_attached_file :userfile,
       path: ':dir_path/:style_:filename',
       use_timestamp: false, styles: lambda { |a| UserfileStyles.get(a.instance)[:styles] },
       only_process: lambda { |a| UserfileStyles.get(a.instance)[:foreground] },
       source_file_options: { all: '-auto-orient' }
    validates_attachment_content_type :userfile, content_type: /.*/
    process_in_background :userfile,
       url_with_processing: false,
       only_process: lambda { |a| UserfileStyles.get(a.instance)[:background] }

    app/models/userfile_styles.rb

    module UserfileStyles
       def self.get userfile
           if userfile.video?
               {
                   styles: {
                       screenshot: ['300x300', :jpg],
                       thumbnail: {
                           gemoetry: '100x100#',
                           format: :jpg,
                           convert_options: '-thumbnail 100%'
                       },
                       preview: {
                           format: 'mp4',
                           convert_options: {
                               output: { ss: '0', t: '10' }
                           },
                           processors: [:transcoder]
                       },
                       mp4: {
                           format: 'mp4',
                           convert_options: {
                               output: {
                                   vcodec: 'libx264',
                                   vb: '1000k',
                                   'profile:v': 'baseline',
                                   vf: 'scale=-2:480',
                                   acodec: 'aac',
                                   ab: '128k',
                                   preset: 'slow',
                                   threads: 0,
                                   movflags: 'faststart',
                               }
                           },
                           processors: [:transcoder]
                       }
                   },
                   foreground: [:screenshot, :thumbnail],
                   background: [:preview, :mp4]
               }
           end
       end
    end

    Example (the first file is being converted from the second file, and the third file is being converted from the fourth file) :

    v2@web1 ~/divshare-v2 $ ls -alh /tmp
    -rw-------  1 v2   v2    70M Sep 10 00:01 2158940a8739e7219125179e0d1528c120160909-14061-8dqfx020160909-14061-egeyeq.mp4
    -rw-------  1 v2   v2   515M Sep  9 23:57 2158940a8739e7219125179e0d1528c120160909-14061-8dqfx0.mp4
    -rw-------  1 v2   v2   145M Sep  9 23:33 76ba144beb8a14b6cf542225ef885a7c20160909-12733-1ui03vo20160909-12733-y7ywn.mp4
    -rw-------  1 v2   v2   604M Sep  9 23:27 76ba144beb8a14b6cf542225ef885a7c20160909-12733-1ui03vo.mp4

    I have tried uploading a couple times and with different files. Always gets caught around the same point. However everything works perfectly when smaller videos ( 100-200MB).

    This is the command being ran :

    v2@web1 ~/divshare-v2 $ ps ux | grep ffmpeg
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    v2       14588 26.4  2.9 849840 240524 ?       Sl   Sep09  12:00 ffmpeg -i /tmp/2158940a8739e7219125179e0d1528c120160909-14061-8dqfx0.mp4 -acodec aac -strict experimental -vcodec libx264 -vb 1000k -profile:v baseline -vf scale=-2:480 -acodec aac -ab 128k -preset slow -threads 0 -movflags faststart -y /tmp/2158940a8739e7219125179e0d1528c120160909-14061-8dqfx020160909-14061-egeyeq.mp4

    Any sort of help debugging this would be awesome.

    NOTE : I copied the above command and manually ran it so that I could see some logs from ffmpeg, and worked flawlessly.

  • Repairing corrupt MOV file

    28 août 2016, par Simon Ridley

    I’m attempting to recover / repair MOV files from a formatted SD card. In the first instance I’ve made a copy of the physical disk using the unix command-line utility "DD". Once that completed I’ve used a working MOV file from the same recording device as a reference file to manually extract the required files using a Hex editor and Python.

    I have attempted to use other recovery tools such as Photorec, and X-Ways, however the extractions appear damaged. This is why I’m using a Hex editor to manually inspect the data to determine what is damaged.

    The software FFMPEG is reporting "moov atom not found" when attempting to process the damaged MOV file.

    When the file is examined in a hex editor I can clearly see that the header appears intact. Offsets 4 to 10 show the ’ftypqt’ signature, then offsets 17 and 16 display ’qt’ and finally the ’mdat’ identifier is at offsets 36 to 39. This is identical to the reference file I have. The mdat container doesn’t appear to finish until ’moov’ which is found at offset 733093392 followed by ’lmvhd’.

    This all appears in the reference file too and as far as I can tell all seems intact. am I correct in thinking that the mdat data is broken in chunks, this is possibly what is referred to as atoms ?

    In which case I appreciate that the data could be damaged somewhere within the mdat. Is it possible to extract the raw data out and rebuild the container ? I’m happy to attempt this with python but I need to understand the structure of the file in more detail. Can anyone help with this please ?

  • 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