
Recherche avancée
Autres articles (56)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...) -
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (6398)
-
Xbox Sphinx Protocol
I’ve gone down the rabbit hole of trying to read the Xbox DVD drive from Linux. Honestly, I’m trying to remember why I even care at this point. Perhaps it’s just my metagame of trying to understand how games and related technologies operate. In my last post of the matter, I determined that it is possible to hook an Xbox drive up to a PC using a standard 40-pin IDE interface and read data sectors. However, I learned that just because the Xbox optical drive is reading an Xbox disc, that doesn’t mean it’s just going to read the sectors in response to a host request.
Oh goodness, no. The drive is going to make the host work for those sectors.
To help understand the concept of locked/unlocked sectors on an Xbox disc, I offer this simplistic diagram :
Any DVD drive (including the Xbox drive) is free to read those first 6992 sectors (about 14 MB of data) which just contain a short DVD video asking the user to insert the disc into a proper Xbox console. Reading the remaining sectors involves performing a sequence of SCSI commands that I have taken to calling the “Sphinx Protocol” for reasons I will explain later in this post.
References
Doing a little Googling after my last post on the matter produced this site hosting deep, technical Xbox information. It even has a page about exactly what I am trying to achieve : Use an Xbox DVD Drive in Your PC. The page provides a tool named dvdunlocker written by “The Specialist” to perform the necessary unlocking. The archive includes a compiled Windows binary as well as its source code. The source code is written in Delphi Pascal and leverages Windows SCSI APIs. Still, it is well commented and provides a roadmap, which I will try to describe in this post.Sphinx Protocol
Here is a rough flowchart of the steps that are (probably) involved in the unlocking of those remaining sectors. I reverse engineered this based on the Pascal tool described in the previous section. Disclaimer : at the time of this writing, I haven’t tested all of the steps due to some Linux kernel problems, described later.
Concerning the challenge/response table that the drive sends back, it’s large (0×664 / 1636 bytes), and not all of the bytes’ meanings are known. However, these are the bytes that seem to be necessary (all multi-byte numbers are big endian) :
bytes 0-1 Size of mode page payload data (should be 0x0662) bytes 2-771 Unknown byte 772 Should be 1 byte 773 Number of entries in challenge/response table bytes 774-1026 Encrypted challenge/response table bytes 1027-1186 Unknown bytes 1187-1230 Key basis (44 bytes) bytes 1231-1635 Unknown
The challenge/response table is the interesting part, but it’s encrypted with RC4 a.k.a. ARCFOUR. The key is derived from the 44 bytes I have labeled “key basis”– cryptographic literature probably has a better term for it ; chime in if you know what that might be. An SHA-1 hash is computed over the 44 bytes.
The resulting SHA-1 hash — the first part of it, to be exact — is fed as the key into the RC4 decryption. The output of SHA-1 contains 160 bits of information. 160 / 8 = 20 bytes of information. To express this as a printable hex digest requires 40 characters. The SHA-1 hash is converted to a hex digest and then the first 7 of the characters are fed into the RC4 initialization function as the key. Then, the RC4 decrypter does its work on the 253 bytes of the challenge/response table.
So that’s why I took to calling this the “Sphinx Protocol” — I felt like I was being challenged with a bizarre riddle. Perhaps that describes a lot of cryptosystems, though You have to admit it sounds kind of cool.
The challenge/response table contains 23 11-byte records. The format of this table is (again, multi-byte numbers are big-endian) :
byte 0 This is 1 if this challenge/response pair is valid byte 1 Challenge ID bytes 2-5 Challenge byte 6 Response ID bytes 7-10 Response
Example
It’s useful to note that the challenge/response table and associated key is different for every disc (at least all the ones I have looked at). So this might be data that comes from the disc, since the values will always be the same for a given disc.Let’s examine Official Xbox Magazine disc #16 (Indiana Jones and The Emperor’s Tomb) :
Before I decrypt the challenge/response table, it looks like this :
0 : 180, 172 : 0xEB100059 ; 66 : 0xD56AFB56 1 : 34, 71 : 0x8F9BF03A ; 192 : 0xC32CBDF8 2 : 226, 216 : 0xA29B77F2 ; 12 : 0x4474A6F1 3 : 72, 122 : 0x9F5ABF33 ; 255 : 0xC5E3C304 4 : 1, 103 : 0x76142ADA ; 233 : 0xDE145D42 **** 5 : 49, 193 : 0xA1CD6192 ; 189 : 0x2169DBA5 6 : 182, 250 : 0x9977894F ; 96 : 0x5A929E2B 7 : 148, 71 : 0x6DD10A54 ; 115 : 0xF0BDAC4F 8 : 12, 45 : 0x5D5EB6FD ; 148 : 0x84E60A00 9 : 99, 121 : 0xFEAED372 ; 201 : 0xDA9986F9 10 : 172, 230 : 0xE6C0D0B4 ; 214 : 0x9050C250 11 : 84, 65 : 0x95CB8775 ; 104 : 0x550886C6 12 : 210, 65 : 0x1ED23619 ; 171 : 0x6DF4A35B 13 : 2, 155 : 0xD0AAE1E0 ; 130 : 0x00D1FFCF 14 : 40, 2 : 0x172EFEB8 ; 159 : 0x37E03E50 15 : 49, 15 : 0x43E5E378 ; 223 : 0x267F9C9A 16 : 240, 173 : 0x357D5D1C ; 250 : 0x24965D67 17 : 80, 184 : 0x5E7AF1A3 ; 81 : 0x3A8F69A7 18 : 154, 186 : 0x6626BEAC ; 245 : 0xE639540A 19 : 231, 249 : 0xFABAAFB7 ; 227 : 0x4C686A07 20 : 150, 186 : 0x9A6D7AA3 ; 133 : 0x25971CF0 21 : 236, 192 : 0x5CD97DD4 ; 247 : 0x26655EFB 22 : 68, 173 : 0xE2D372E4 ; 207 : 0x103FBF94 there are 1 valid pairs in the list : 4
My best clue that it’s not right is that there is only 1 valid entry (denoted by my tool using ****). The source I reverse engineered for this data indicates that there needs to be at least 2 valid pairs. After running the RC4 decryption on the table, it looks like this and I get far more valid pairs :
0 : 1, 174 : 0xBD628255 ; 0 : 0x9F0A31AF **** 1 : 2, 176 : 0x3151B341 ; 2 : 0x9C87C180 2 : 3, 105 : 0x018879E5 ; 1 : 0xFF068B5C 3 : 2, 7 : 0x1F316AAF ; 3 : 0xF420D3ED 4 : 3, 73 : 0xC2EBFBE9 ; 0 : 0x17062B5B 5 : 252, 163 : 0xFF14B5CB ; 236 : 0xAF813FBC 6 : 2, 233 : 0x5EE95C49 ; 1 : 0x37AA5511 7 : 1, 126 : 0xBD628255 ; 0 : 0x5BA3FBD4 **** 8 : 3, 4 : 0xB68BFEE6 ; 3 : 0xA8F3B918 9 : 3, 32 : 0xEA614943 ; 2 : 0xA678D715 10 : 2, 248 : 0x1BDD374E ; 0 : 0x8D2AC2C7 11 : 3, 17 : 0x0EABCE81 ; 2 : 0xC90A7242 12 : 1, 186 : 0xBD628255 ; 0 : 0xC4820242 **** 13 : 3, 145 : 0xB178F942 ; 3 : 0x4D78AD62 14 : 3, 37 : 0x4A6CE5E2 ; 2 : 0xBF94E1C6 15 : 1, 102 : 0xBD628255 ; 0 : 0xFFB83D8D **** 16 : 3, 122 : 0xF97B0905 ; 1 : 0x38533125 17 : 3, 197 : 0x57A6865D ; 2 : 0xA61D31EF 18 : 3, 27 : 0xC7227D7C ; 2 : 0xA3F9BA1E 19 : 1, 16 : 0xBD628255 ; 0 : 0x8557CCC8 **** 20 : 2, 53 : 0x1DA9D156 ; 3 : 0xC9051754 21 : 2, 90 : 0x3CD66BEE ; 3 : 0xFD851D3E 22 : 1, 252 : 0xBD628255 ; 0 : 0xB3F22701 **** there are 6 valid pairs in the list : 0 7 12 15 19 22
So, hopefully, I have the decryption correct.
Also of note is that you only get one chance to get this unlocking correct– fail, and the drive won’t return a valid DVD structure block again. You will either need to reboot the Xbox or eject & close the tray before you get to try again.
Problems Making It Work In Linux
There are a couple of ways to play with SCSI protocols under Linux. In more recent kernels, block devices are named /dev/sda, /dev/sdb, etc. Each of these block devices has a corresponding character device named /dev/sg0, /dev/sg1, etc. ‘sg’ stands for SCSI generic. This character devices can be opened as readable and/or writable and SCSI commands can be freely written with write() and data retrieved with read(). Pretty powerful.Except that the one machine I still possess which supports 40-pin IDE/ATAPI devices is running Linux kernel 2.6.24 which dates back to early 2008 and it still enumerates the IDE block devices as /dev/hda, /dev/hdb, etc. There are no corresponding /dev/sgX character devices. What to do ? It seems that a program can still issue SCSI commands using an ioctl() facility named SG_IO.
I was able to make the SG_IO ioctl() work for the most part (except for the discovery that the Xbox drive doesn’t respond to a basic SCSI Inquiry command). However, I ran into a serious limitation– a program can only open a /dev/hdX block device in read-only mode if the device corresponds to a read-only drive like, for example, a DVD-ROM drive. This means that a program can’t issue SCSI mode select commands to the drive, which counts as writing. This means that my tool can’t unlock the drive.
Current Status
So this is where my experiment is blocked right now. I have been trying to compile various Linux kernels to remedy the situation. But I always seem to find myself stuck in one of 2 situations, depending on the configuration options I choose : Either the drives are enumerated with the /dev/hdX convention and I am stuck in read-only mode (with no mode select) ; or the drives are enumerated with /dev/sdX along with corresponding /dev/sgN character devices, in which case the kernel does not recognize the Xbox DVD-ROM drive.This makes me wonder if there’s a discrepancy between the legacy ATA/ATAPI drivers (which sees the drive) and the newer SATA/PATA subsystem (which doesn’t see the drive). I also wonder about hacking the kernel logic to allow SCSI mode select logic to proceed to the device for a read-only file handle.
-
Trouble writing mp3 into flv container
8 février 2013, par SriramI am encoding a raw pcm stream with
LAME
and writing the mp3 encoded samples to an flv container using ac
program. For debugging purposes, I am also writing the mp3 encoded samples to a file separately. The following is observed :- The mp3 written to another file is correct. There are no clicks or any other artefacts observed.
-
The flv file does not play anything. Examining with
ffmpeg
like so :$ ./ffmpeg.exe -i temp_local_flv.flv
The above command gives the following :
ffmpeg version N-49352-gc46943e Copyright (c) 2000-2013 the FFmpeg developers
built on Jan 26 2013 12:12:14 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 17.100 / 52. 17.100
libavcodec 54. 91.100 / 54. 91.100
libavformat 54. 61.104 / 54. 61.104
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 34.101 / 3. 34.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[flv @ 0000000000307be0] Stream discovered after head already parsed
[mp3 @ 000000000237d9c0] Header missing
Input #0, flv, from 'temp_local_flv.flv':
Duration: 00:00:00.07, start: 0.002000, bitrate: 643 kb/s
Stream #0:0: Audio: mp3, 22050 Hz, mono, s16p, 32 kb/s
Stream #0:1: Data: none
At least one output file must be specifiedMy questions :
1. What is this "Header missing" ? Is there a "special" mp3 header that needs to be written when writing encoded samples to an flv container ? If so, what does the header contain ? And given that the mp3 samples written to the file are decoded correctly by an audio player, what am I missing ? -
ffmpeg transcode
12 novembre 2015, par user2004388I want to do a audio trancode using ffmpeg library. Now i have out file but I can listen only noise .
The steps of my program are :
1) Open input file and decode in raw format using avcodec_decode_audio4
2) encode and save the raw format .
I don’t Know where I wrong. This is my code./*
* File: newmain.c
* Author: antonello
*
* Created on 23 gennaio 2013, 11.24
*/
#include
#include
#include <libavutil></libavutil>samplefmt.h>
#include <libavutil></libavutil>timestamp.h>
#include <libavformat></libavformat>avformat.h>
#include <libavcodec></libavcodec>old_codec_ids.h>
static AVCodecContext *get_encoder(int sampleRate, int channels, int audioBitrate)
{
AVCodecContext *audioCodec;
AVCodec *codec;
//Set up audio encoder
codec = avcodec_find_encoder(CODEC_ID_AAC);
if (codec == NULL)
{
printf("avcodec_find_encoder: ERROR\n");
return NULL;
}
audioCodec = avcodec_alloc_context();
audioCodec->bit_rate = audioBitrate;
audioCodec->sample_fmt = AV_SAMPLE_FMT_S16P;
audioCodec->sample_rate = sampleRate;
audioCodec->channels = channels;
audioCodec->profile = FF_PROFILE_AAC_MAIN;
audioCodec->channel_layout=AV_CH_LAYOUT_MONO;
//audioCodec->time_base = (AVRational){1, sampleRate};
audioCodec->time_base.num = 1;
audioCodec->time_base.den = sampleRate;
audioCodec->codec_type = AVMEDIA_TYPE_AUDIO;
if (avcodec_open(audioCodec, codec) < 0)
{
printf("avcodec_open: ERROR\n");
return NULL;
}
return audioCodec;
}
int main(int argc, char** argv) {
AVFormatContext *aFormatCtx_decoder = NULL;
AVFormatContext *aFormatCtx_encoder = NULL;
int i, audioStream;
AVPacket packet_decoder;
AVPacket packet_encoder;
int got_frame=0;
int complete_decode=0;
int len;
AVFrame *decoded_frame = NULL;
AVCodecContext *aCodec_decoderCtx = NULL;
AVCodec *aCodec_decoder = NULL;
FILE *outfile;
//reding input file
avcodec_register_all();
//register all codecs
av_register_all();
//open file
if(avformat_open_input(&aFormatCtx_decoder, "sample.aac", NULL, NULL)!=0){
fprintf(stderr, "Could not open source file \n");
return -1; // Couldn't open file
}
// Retrieve stream information
if(avformat_find_stream_info(aFormatCtx_decoder, NULL)<0){
fprintf(stderr, "Couldn't find stream information \n");
return -1; // Couldn't find stream information
}
// Dump information about file onto standard error
//av_dump_format(aFormatCtx_decode, 0, argv[1], 0);
// Find the first audio stream
audioStream=-1;
for(i=0; inb_streams; i++) {
if(aFormatCtx_decoder->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO &&
audioStream < 0) {
audioStream=i;
}
}
if(audioStream==-1){
fprintf(stderr, "File haven't sudio stream \n");
return -1;
}
//get audio codec contex
aCodec_decoderCtx=aFormatCtx_decoder->streams[audioStream]->codec;
//get audio codec
aCodec_decoder = avcodec_find_decoder(aCodec_decoderCtx->codec_id);
aCodec_decoder->sample_fmts=AV_SAMPLE_FMT_S16P;
if(!aCodec_decoder) {
fprintf(stderr, "Unsupported codec!\n");
return -1;//Unsupported codec!
}
//open codec
// Open codec
if(avcodec_open2(aCodec_decoderCtx, aCodec_decoder, NULL)<0)
return -1; // Could not open codec
// allocate audio frame
decoded_frame = avcodec_alloc_frame();
if (!decoded_frame) {
fprintf(stderr, "Could not allocate audio frame\n");
return -1;//Could not allocate audio frame
}
aCodec_decoderCtx->bit_rate=12000;
aFormatCtx_encoder=get_encoder(8000,1,12000);
av_init_packet(&packet_encoder);
printf("param %d %d %d",aCodec_decoderCtx->sample_fmt,aCodec_decoderCtx->channels,aCodec_decoderCtx->bit_rate);
outfile = fopen("out.aac", "wb");
if (!outfile) {
printf(stderr, "Could not open outfile \n");
return -1;//Could not open outfile
}
while(av_read_frame(aFormatCtx_decoder, &packet_decoder)>=0) {
// decode frame
len = avcodec_decode_audio4(aCodec_decoderCtx, decoded_frame, &got_frame, &packet_decoder);
if (len < 0) {
fprintf(stderr, "Error while decoding\n");
return -1;
}
if (got_frame){
avcodec_encode_audio2(aFormatCtx_encoder,&packet_encoder,decoded_frame,&complete_decode);
if(complete_decode){
// printf("complete decode frame");
fwrite(packet_encoder.data, 1, packet_encoder.size, outfile);
av_free_packet(&packet_encoder);
}
}
}
fclose(outfile);
return (EXIT_SUCCESS);
}