Recherche avancée

Médias (91)

Autres articles (102)

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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (9239)

  • Watson NarrowBand Speech to Text not accepting ogg file

    19 janvier 2017, par Bob Dill

    NodeJS app using ffmpeg to create ogg files from mp3 & mp4. If the source file is broadband, Watson Speech to Text accepts the file with no issues. If the source file is narrow band, Watson Speech to Text fails to read the ogg file. I’ve tested the output from ffmpeg and the narrowband ogg file has the same audio content (e.g. I can listen to it and hear the same people) as the mp3 file. Yes, in advance, I am changing the call to Watson to correctly specify the model and content_type. Code follows :

    exports.createTranscript = function(req, res, next)
    { var _name = getNameBase(req.body.movie);
     var _type = getType(req.body.movie);
     var _voice = (_type == "mp4") ? "en-US_BroadbandModel" : "en-US_NarrowbandModel" ;
     var _contentType = (_type == "mp4") ? "audio/ogg" : "audio/basic" ;
     var _audio = process.cwd()+"/HTML/movies/"+_name+'ogg';
     var transcriptFile = process.cwd()+"/HTML/movies/"+_name+'json';

     speech_to_text.createSession({model: _voice}, function(error, session) {
       if (error) {console.log('error:', error);}
       else
         {
           var params = { content_type: _contentType, continuous: true,
            audio: fs.createReadStream(_audio),
             session_id: session.session_id
             };
             speech_to_text.recognize(params, function(error, transcript) {
               if (error) {console.log('error:', error);}
               else
                 { fs.writeFile(transcriptFile, JSON.stringify(transcript), function(err) {if (err) {console.log(err);}});
                   res.send(transcript);
                 }
             });
         }
     });
    }

    _type is either mp3 (narrowband from phone recording) or mp4 (broadband)
    model: _voice has been traced to ensure correct setting
    content_type: _contentType has been traced to ensure correct setting

    Any ogg file submitted to Speech to Text with narrowband settings fails with Error: No speech detected for 30s. Tested with both real narrowband files and asking Watson to read a broadband ogg file (created from mp4) as narrowband. Same error message. What am I missing ?

  • 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.

  • How to transcode MP3 files in django by using FFMPEG, Celery and RabbitMQ ?

    12 janvier 2017, par Srinivas 25

    I am trying to transcode user uploaded MP3 audio files into ogg, ac3 wav or other formats by using django, celery, rabbitMQ and FFMPEG. But i am getting the error with [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call

    OS-Window 10-64bit
    Python 3.0
    Django - 1.10

    here is the code I followed :

    models.py
    import uuid
    from django.db import models

      # Create your models here.

       def unique_file_path(instance, filename):
       new_file_name = uuid.uuid4()
       return str(new_file_name)

       class AudioFile(models.Model):
       name = models.CharField(max_length=100, blank=True)
       mp3_file = models.FileField(upload_to=unique_file_path)
       ogg_file = models.FileField(blank=True, upload_to=unique_file_path)
       wav_file = models.FileField(blank=True, upload_to=unique_file_path)
       ac3_file = models.FileField(blank=True, upload_to=unique_file_path)

       def __str__(self):
           return self.name

       views.py
       from django.shortcuts import render

       # Create your views here.

       from django.views.generic.edit import FormView
       from django.http import HttpResponseRedirect
       from django.core.urlresolvers import reverse

       from django.views.generic import FormView
       from audio_transcoder.taskapp.tasks import transcode_mp3

       from .forms import AudioFileFrom
       from .models import AudioFile

       class UploadAudioFileView(FormView):
       template_name = 'upload/upload.html'
       form_class = AudioFileFrom


       def form_valid(self, form):
           audio_file = AudioFile(
               name=self.get_form_kwargs().get('data')['name'],
               mp3_file=self.get_form_kwargs().get('files')['mp3_file']
           )
           audio_file.save()
           transcode_mp3.delay(audio_file.id)

           return HttpResponseRedirect(self.get_success_url())

       def get_success_url(self):
           return reverse('/')


       tasks.py
       import os
       import os.path
       import subprocess

       from audio_transcoder.taskapp.celery import app




       from celery import Celery

       app = Celery('fftest',
                broker='amqp://guest@localhost//',
                include=['taskapp.tasks'])

       if __name__ == '__main__':
       app.start()

       from audio_transcoder.models import AudioFile
       import fftest.settings as settings

       @app.task
       def transcode_mp3(mp3_id):
       audio_file = AudioFile.objects.get(id=mp3_id)
       input_file_path = audio_file.mp3_file.path
       filename = os.path.basename(input_file_path)

       ogg_output_file_name = os.path.join('transcoded', '{}.ogg'.format(filename))
       ogg_output_file_path = os.path.join(settings.MEDIA_ROOT, ogg_`enter code    
       here`output_file_name)
       enter code here
       ac3_output_file_name = os.path.join('transcoded', '{}.ac3'.format(filename))
       ac3_output_file_path = os.path.join(settings.MEDIA_ROOT,  
       ac3_output_file_name)

       wav_output_file_name = os.path.join('transcoded', '{}.wav'.format(filename))
       wav_output_file_path = os.path.join(settings.MEDIA_ROOT,
       wav_output_file_name)

       if not os.path.isdir(os.path.dirname(ogg_output_file_path)):
           os.makedirs(os.path.dirname(ogg_output_file_path))

       subprocess.call([
               settings.FFMPEG_PATH,
               '-i',
               input_file_path,
               ogg_output_file_path,
               ac3_output_file_path,
               wav_output_file_path
           ]
       )

       audio_file.ogg_file = ogg_output_file_name
       audio_file.ac3_file = ac3_output_file_name
       audio_file.wav_file = wav_output_file_name
       audio_file.save()

    Not sure where the mistake is happening. While uploading video it is showing below :

    OperationalError at /new/
    [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
    Request Method: POST
    Request URL:  http://127.0.0.1:8000/new/
    Django Version: 1.10.4
    Exception Type: OperationalError`enter code here`
    Exception Value:  
    [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
    Exception Location: C:\Users\RAMa2r3e4s5h6\fftest\lib\site-packages\amqp\transport.py in _set_socket_options, line 204