Advanced search

Medias (91)

Other articles (63)

  • Le profil des utilisateurs

    12 April 2011, by

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 November 2010, by

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 May 2011, by

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

On other websites (4312)

  • Automation for Downloading, Encoding, Renaming and Uploading [on hold]

    5 February 2019, by Madara Uchiha

    How do I automate - downloading anime episodes from Torrent > Encode the videos with ffmpeg or gui > rename (with encoder tag) > upload to Google drive?
    Should work 24/7. Need help!

  • Broadcast mjpeg stream via websocket using ffmpeg and Python Tornado

    25 February 2016, by Asampaiz

    Well, i have been strugling for weeks now. Searching and reading a hundred of pages and nearly surrender.

    I need your help, this is the story: I want to stream my Logitech C930e webcam (connected to Raspi 2) to web browser. I have tried so many different way, such as using ffserver to pass the stream from ffmpeg to the web browser, but all of that is using same basic, it’s all need a re-encoding. ffserver will always re-encode the stream that passed by ffmpeg, no matter it is already on the right format or not. My webcam have built-in video encoding to mjpeg until 1080p, so that is the reason why i use this webcam, i don’t want using all of Raspi 2 resource just for encoding those stream.

    This approach end up in eating all my Raspi 2 Resources.

    Logitech C930e ---mjpeg 720p (compressed) instead of rawvideo---> ffmjpeg (copy, no reencoding) —http—> ffserver(mjpeg, reencoding to mjpeg;this is the problem) —http—> Firefox

    My new approach

    Logitech C930e ---mjpeg 720p (compressed) instead of rawvideo---> ffmjpeg (copy, no reencoding —pipe—> Python3 (using tornado as the web framework) —websocket—> Firefox

    The problem of the new approach

    The problem is i can not make sure the stream format that passed by ffmpeg via pipe to Python is ready | compatible to be streamed to browser via websocket. I mean i already do all these step above but the result is unreadable image shown in the browser (like TV lost signal).

    1. I need help figuring out how to feed python the right mjpeg stream format with ffmpeg
    2. I need help on the client side (javascript) how to show the binary message that sent via websocket (the mjpeg stream)

    This is my current script

    Executing ffmpeg in Python (pipe) - Server Side

    --- cut ---
           multiprocessing.Process.__init__(self)
           self.resultQ = resultQ
           self.taskQ = taskQ
           self.FFMPEG_BIN = "/home/pi/bin/ffmpeg"
           self.video_w = 1280
           self.video_h = 720
           self.video_res = '1280x720'
           self.webcam = '/dev/video0'
           self.frame_rate = '10'
           self.command = ''
           self.pipe = ''
           self.stdout = ''
           self.stderr = ''

       #Start the ffmpeg, this parameter need to be ajusted,
       #video format already tried rawvide, singlejpeg, mjpeg
       #mpjpeg, image2pipe
       #i need help here (to make sure the format is right for pipe)
       def camera_stream_start(self):
               self.command = [ self.FFMPEG_BIN,
                   '-loglevel', 'debug',
                   '-y',
                   '-f', 'v4l2',
                   '-input_format', 'mjpeg',
                   '-s', self.video_res,
                   '-r', self.frame_rate,
                   '-i', self.webcam,
                   '-c:v', 'copy',
                   '-an',
                   '-f', 'rawvideo',
                   #'-pix_fmts', 'rgb24',
                   '-']
               self.pipe = sp.Popen(self.command, stdin=sp.PIPE, stdout = sp.PIPE, shell=False)
               #return self.pipe

       #stop ffmpeg
       def camera_stream_stop(self):
           self.pipe.stdout.flush()
           self.pipe.terminate()
           self.pipe = ''
           #return self.pipe

       def run(self):
           #start stream
           self.camera_stream_start()
           logging.info("** Camera process started")
           while True:
               #get the stream from pipe,
               #this part is also need to be ajusted
               #i need help here
               #processing the stream read so it can be
               #send to browser via websocket
               stream = self.pipe.stdout.read(self.video_w*self.video_h*3)

               #reply format to main process
               #in main process, the data will be send over binary websocket
               #to client (self.write_message(data, binary=True))
               rpl = {
                   'task' : 'feed',
                   'is_binary': True,
                   'data' : stream
               }
               self.pipe.stdout.flush()
               self.resultQ.put(rpl)
               #add some wait
               time.sleep(0.01)
           self.camera_stream_stop()
           logging.info("** Camera process ended")

    ffmpeg output

    --- Cut ---    
    Successfully opened the file.
    Output #0, rawvideo, to 'pipe:':
     Metadata:
       encoder         : Lavf57.26.100
       Stream #0:0, 0, 1/10: Video: mjpeg, 1 reference frame, yuvj422p(center), 1280x720 (0x0), 1/10, q=2-31, -1 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    --- Cut ---    

    JavaScript websocket - on the client side

    --- Cut ---
    socket = new WebSocket(url, protocols || []);
    socket.binaryType = "arraybuffer";

    socket.onmessage = function (message) {
       //log.debug(message.data instanceof ArrayBuffer);
       //This is for the stream that sent via websocket
       if(message.data instanceof ArrayBuffer)
       {
           //I need help here
           //How can i process the binary stream
           //so its can be shown in the browser (img)
           var bytearray = new Uint8Array(message.data);
           var imageheight = 720;
           var imagewidth = 1280;

           var tempcanvas = document.createElement('canvas');
           tempcanvas.height = imageheight;
           tempcanvas.width = imagewidth;
           var tempcontext = tempcanvas.getContext('2d');

           var imgdata = tempcontext.getImageData(0,0,imagewidth,imageheight);

           var imgdatalen = imgdata.data.length;

           for(var i=8;i/this is for ordinary string that sent via websocket
       else{
           pushData = JSON.parse(message.data);
           console.log(pushData);
       }

    --- Cut ---

    Any help, feedback or anything is very appreciated. If something not clear please advice me.

  • Reverse Engineering Italian Literature

    1 July 2014, by Multimedia Mike — Reverse Engineering

    Some time ago, Diego “Flameeyes” Pettenò tried his hand at reverse engineering a set of really old CD-ROMs containing even older Italian literature. The goal of this RE endeavor would be to extract the useful literature along with any structural metadata (chapters, etc.) and convert it to a more open format suitable for publication at, e.g., Project Gutenberg or Archive.org.

    Unfortunately, the structure of the data thwarted the more simplistic analysis attempts (like inspecting for blocks of textual data). This will require deeper RE techniques. Further frustrating the effort, however, is the fact that the binaries that implement the reading program are written for the now-archaic Windows 3.1 operating system.

    In pursuit of this RE goal, I recently thought of a way to glean more intelligence using DOSBox.

    Prior Work
    There are 6 discs in the full set (distributed along with 6 sequential issues of a print magazine named L’Espresso). Analysis of the contents of the various discs reveals that many of the files are the same on each disc. It was straightforward to identify the set of files which are unique on each disc. This set of files all end with the extension “LZn”, where n = 1..6 depending on the disc number. Further, the root directory of each disc has a file indicating the sequence number (1..6) of the CD. Obviously, these are the interesting targets.

    The LZ file extensions stand out to an individual skilled in the art of compression– could it be a variation of the venerable LZ compression? That’s actually unlikely because LZ — also seen as LIZ — stands for Letteratura Italiana Zanichelli (Zanichelli’s Italian Literature).

    The Unix ‘file’ command was of limited utility, unable to plausibly identify any of the files.

    Progress was stalled.

    Saying Hello To An Old Frenemy
    I have been showing this screenshot to younger coworkers to see if any of them recognize it:


    DOSBox running Window 3.1

    Not a single one has seen it before. Senior computer citizen status: Confirmed.

    I recently watched an Ancient DOS Games video about Windows 3.1 games. This episode showed Windows 3.1 running under DOSBox. I had heard this was possible but that it took a little work to get running. I had a hunch that someone else had probably already done the hard stuff so I took to the BitTorrent networks and quickly found a download that had the goods ready to go– a directory of Windows 3.1 files that just had to be dropped into a DOSBox directory and they would be ready to run.

    Aside: Running OS software procured from a BitTorrent network? Isn’t that an insane security nightmare? I’m not too worried since it effectively runs under a sandboxed virtual machine, courtesy of DOSBox. I suppose there’s the risk of trojan’d OS software infecting binaries that eventually leave the sandbox.

    Using DOSBox Like ‘strace’
    strace is a tool available on some Unix systems, including Linux, which is able to monitor the system calls that a program makes. In reverse engineering contexts, it can be useful to monitor an opaque, binary program to see the names of the files it opens and how many bytes it reads, and from which locations. I have written examples of this before (wow, almost 10 years ago to the day; now I feel old for the second time in this post).

    Here’s the pitch: Make DOSBox perform as strace in order to serve as a platform for reverse engineering Windows 3.1 applications. I formed a mental model about how DOSBox operates — abstracted file system classes with methods for opening and reading files — and then jumped into the source code. Sure enough, the code was exactly as I suspected and a few strategic print statements gave me the data I was looking for.

    Eventually, I even took to running DOSBox under the GNU Debugger (GDB). This hasn’t proven especially useful yet, but it has led to an absurd level of nesting:


    GDB runs DOSBox runs Windows 3.1

    The target application runs under Windows 3.1, which is running under DOSBox, which is running under GDB. This led to a crazy situation in which DOSBox had the mouse focus when a GDB breakpoint was triggered. At this point, DOSBox had all desktop input focus and couldn’t surrender it because it wasn’t running. I had no way to interact with the Linux desktop and had to reboot the computer. The next time, I took care to only use the keyboard to navigate the application and trigger the breakpoint and not allow DOSBox to consume the mouse focus.

    New Intelligence

    By instrumenting the local file class (virtual HD files) and the ISO file class (CD-ROM files), I was able to watch which programs and dynamic libraries are loaded and which data files the code cares about. I was able to narrow down the fact that the most interesting programs are called LEGGENDO.EXE (‘reading’) and LEGGENDA.EXE (‘legend’; this has been a great Italian lesson as well as RE puzzle). The first calls the latter, which displays this view of the data we are trying to get at:


    LIZ: Authors index

    When first run, the program takes an interest in a file called DBBIBLIO (‘database library’, I suspect):

    === Read(’LIZ98\DBBIBLIO.LZ1’): req 337 bytes; read 337 bytes from pos 0x0
    === Read(’LIZ98\DBBIBLIO.LZ1’): req 337 bytes; read 337 bytes from pos 0x151
    === Read(’LIZ98\DBBIBLIO.LZ1’): req 337 bytes; read 337 bytes from pos 0x2A2
    [...]
    

    While we were unable to sort out all of the data files in our cursory investigation, a few things were obvious. The structure of this file looked to contain 336-byte records. Turns out I was off by 1– the records are actually 337 bytes each. The count of records read from disc is equal to the number of items shown in the UI.

    Next, the program is interested in a few more files:

    *** isoFile(): ’DEPOSITO\BLOKCTC.LZ1’, offset 0x27D6000, 2911488 bytes large
    === Read(’DEPOSITO\BLOKCTC.LZ1’): req 96 bytes; read 96 bytes from pos 0x0
    *** isoFile(): ’DEPOSITO\BLOKCTX0.LZ1’, offset 0x2A9D000, 17152 bytes large
    === Read(’DEPOSITO\BLOKCTX0.LZ1’): req 128 bytes; read 128 bytes from pos 0x0
    === Seek(’DEPOSITO\BLOKCTX0.LZ1’): seek 384 (0x180) bytes, type 0
    === Read(’DEPOSITO\BLOKCTX0.LZ1’): req 256 bytes; read 256 bytes from pos 0x180
    === Seek(’DEPOSITO\BLOKCTC.LZ1’): seek 1152 (0x480) bytes, type 0
    === Read(’DEPOSITO\BLOKCTC.LZ1’): req 32 bytes; read 32 bytes from pos 0x480
    === Read(’DEPOSITO\BLOKCTC.LZ1’): req 1504 bytes; read 1504 bytes from pos 0x4A0
    [...]

    Eventually, it becomes obvious that BLOKCTC has the juicy meat. There are 32-byte records followed by variable-length encoded text sections. Since there is no text to be found in these files, the text is either compressed, encrypted, or both. Some rough counting (the program seems to disable copy/paste, which thwarts more precise counting), indicates that the text size is larger than the data chunks being read from disc, so compression seems likely. Encryption isn’t out of the question (especially since the program deems it necessary to disable copy and pasting of this public domain literary data), and if it’s in use, that means the key is being read from one of these files.

    Blocked On Disassembly
    So I’m a bit blocked right now. I know exactly where the data lives, but it’s clear that I need to reverse engineer some binary code. The big problem is that I have no idea how to disassemble Windows 3.1 binaries. These are NE-type executable files. Disassemblers abound for MZ files (MS-DOS executables) and PE files (executables for Windows 95 and beyond). NE files get no respect. It’s difficult (but not impossible) to even find data about the format anymore, and details are incomplete. It should be noted, however, the DOSBox-as-strace method described here lends insight into how Windows 3.1 processes NE-type EXEs. You can’t get any more authoritative than that.

    So far, I have tried the freeware version of IDA Pro. Unfortunately, I haven’t been able to get the program to work on my Windows machine for a long time. Even if I could, I can’t find any evidence that it actually supports NE files (the free version specifically mentions MZ and PE, but does not mention NE or LE).

    I found an old copy of Borland’s beloved Turbo Assembler and Debugger package. It has Turbo Debugger for Windows, both regular and 32-bit versions. Unfortunately, the normal version just hangs Windows 3.1 in DOSBox. The 32-bit Turbo Debugger loads just fine but can’t load the NE file.

    I’ve also wondered if DOSBox contains any advanced features for trapping program execution and disassembling. I haven’t looked too deeply into this yet.

    Future Work
    NE files seem to be the executable format that time forgot. I have a crazy brainstorm about repacking NE files as MZ executables so that they could be taken apart with an MZ disassembler. But this will take some experimenting.

    If anyone else has any ideas about ripping open these binaries, I would appreciate hearing them.

    And I guess I shouldn’t be too surprised to learn that all the literature in this corpus is already freely available and easily downloadable anyway. But you shouldn’t be too surprised if that doesn’t discourage me from trying to crack the format that’s keeping this particular copy of the data locked up.