Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (63)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (8699)

  • How to get video frame for a specific time from mp4

    11 décembre 2015, par man-r

    i have an mp4 video byte array and i need to generate a thumbnail for it using its middle frame (e.g. if the video length is 10 seconds then i need to get the picture from 5th second).

    i managed to parse through the file and extract its boxes (atom). i have also managed to get the video length from the mvhd box. also i managed to extract
    1. the time-To-Sample table from stts box,
    2. the sample-To-Chunk table from stcs box,
    3. the chunk-Offset table from stco box,
    4. the sample Size table from stsz box,
    5. the Sync Sample table from stss box

    i know that all the actual media are available in the mdat box and that i need to correlate the above table to find the exact frame offset in the file but my question is how ? the tables data seems to be compressed (specially the time-To-Sample table) but i don’t know how decompress them.

    any help is appreciated.

    below are code samples

    code to convert byte to hex

    public static char[] bytesToHex(byte[] bytes) {
       char[] hexChars = new char[bytes.length * 2];
       for ( int j = 0; j < bytes.length; j++ ) {
           int v = bytes[j] & 0xFF;

           hexChars[j * 2] = hexArray[v >>> 4];
           hexChars[j * 2 + 1] = hexArray[v & 0x0F];            
       }
       return hexChars;
    }

    code for getting the box offset

    final static String MOOV                          = "6D6F6F76";
    final static String MOOV_MVHD                     = "6D766864";
    final static String MOOV_TRAK                     = "7472616B";
    final static String MOOV_TRAK_MDIA                = "6D646961";
    final static String MOOV_TRAK_MDIA_MINF           = "6D696E66";
    final static String MOOV_TRAK_MDIA_MINF_STBL      = "7374626C";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSD = "73747364";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STTS = "73747473";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSS = "73747373";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSC = "73747363";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STCO = "7374636F";
    final static String MOOV_TRAK_MDIA_MINF_STBL_STSZ = "7374737A";

    static int getBox(char[] s, int offset, String type) {
       int typeOffset = -1;
       for (int i = offset*2; i-1) {
                   break;
               }
           }
           i+=(size*2);
       }

       return typeOffset;
    }

    code for getting the duration and timescale

    static int[] getDuration(char[] s) {
       int mvhdOffset = getBox(s, 0, MOOV_MVHD);
       int timeScaleStart = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4)*2;
       int timeScaleEnd   = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;

       int durationStart  = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4)*2;
       int durationEnd    = (mvhdOffset*2) + (4 + 4 + 1 + 3 + 4 + 4 + 4 + 4)*2;

       String timeScaleHex = new String(Arrays.copyOfRange(s, timeScaleStart, timeScaleEnd));
       String durationHex = new String(Arrays.copyOfRange(s, durationStart, durationEnd));

       int timeScale = Integer.parseInt(timeScaleHex, 16);
       int duration = Integer.parseInt(durationHex, 16);

       int[] result = {duration, timeScale};
       return result;
    }

    code to get the time-To-Sample table

    static int[][] getTimeToSampleTable(char[] s, int trakOffset) {
       int offset = getBox(s, trakOffset, MOOV_TRAK_MDIA_MINF_STBL_STTS);
       int sizeStart = offset*2;
       int sizeEnd   = offset*2 + (4)*2;

       int typeStart = offset*2 + (4)*2;
       int typeEnd   = offset*2 + (4 + 4)*2;

       int noOfEntriesStart = offset*2 + (4 + 4 + 1 + 3)*2;
       int noOfEntriesEnd   = offset*2 + (4 + 4 + 1 + 3 + 4)*2;

       String sizeHex = new String(Arrays.copyOfRange(s, sizeStart, sizeEnd));
       String typeHex = new String(Arrays.copyOfRange(s, typeStart, typeEnd));
       String noOfEntriesHex = new String(Arrays.copyOfRange(s, noOfEntriesStart, noOfEntriesEnd));

       int size = Integer.parseInt(sizeHex, 16);
       int noOfEntries = Integer.parseInt(noOfEntriesHex, 16);

       int[][] timeToSampleTable = new int[noOfEntries][2];

       for (int i = 0; icode>
  • Reverse Engineering Italian Literature

    1er juillet 2014, par 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.

  • Discord Voice Bot cannot play the audio file

    7 avril 2023, par Jakub Nawrocki

    I tried to write a bot that will join the voice channel and play a audio at 20:00.

    


    Currently the bot joins the channel, but immediately after that it disconnects without making a single sound with this message :

    


    2023-04-07 17:58:01 INFO     discord.player ffmpeg process 18258 has not terminated. Waiting to terminate... 2023-04-07 17:58:01 INFO     discord.player ffmpeg process 18258 should have terminated with a return code of -9. 2023-04-07 17:58:01 INFO     discord.voice_client The voice handshake is being terminated for Channel ID 1093533451778523241 (Guild ID 1093533451778523237) 2023-04-07 17:58:01 INFO     discord.voice_client Disconnecting from voice normally, close code 1000. Audio file loaded:  Audio could not be played:

    


    Code :

    


    import discord
import asyncio
import datetime

TOKEN = 'TOKEN HERE' 
CHANNEL_ID = CHANNEL ID HERE

client = discord.Client(intents=discord.Intents.all())

async def play_sound(voice_client):
    try:
        source = discord.FFmpegPCMAudio('audio.mp3')
        print(f"Audio file loaded: {source}")
        voice_client.play(source)
        while voice_client.is_playing():
            await asyncio.sleep(1)
    except Exception as e:
        print(f"Audio could not be played: {e}")

@client.event
async def on_ready():
    print('Bot is ready')
    now = datetime.datetime.now()
    target_time = datetime.time(hour=20, minute=00)
    if now.time() >= target_time:
        print(f"Current time: {now.time()}. Bot did not join channel.")
        return
    else:
        print(f"Current time: {now.time()}. Bot has joined at {target_time}.")
        await asyncio.sleep((datetime.datetime.combine(datetime.date.today(), target_time) - now).total_seconds())
        channel = client.get_channel(CHANNEL_ID)
        if channel is not None:
            try:
                voice_client = await channel.connect()
                print(f'{client.user} joined voice chat.')
                await asyncio.sleep(1)
                await play_sound(voice_client)
                await voice_client.disconnect()
                print(f'{client.user} left voice chat.')
            except Exception as e:

                print(f"Error during joining channel : {e}")
        else:
            print(f"Did not find a channel of ID {CHANNEL_ID}.")

client.run(TOKEN)


    


    Any ideas ?

    


    ffmpeg has been installed properly.