Recherche avancée

Médias (0)

Mot : - Tags -/serveur

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (93)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (7826)

  • Xbox Sphinx Protocol

    21 octobre 2013, par Multimedia Mike — DRM, xbox

    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 :


    Xbox locked disc 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.


    Xbox SCSI Unlock Protocol

    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) :


    Xbox Magazine #16 featuring Indiana Jones

    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.

  • getting errors from FFMpeg when spawned from .NET

    18 mars 2014, par Brannon

    When I run FFMpeg from the command line like this

    ffmpeg.exe -hwaccel auto -re -i "C:\Users\Public\Videos\Sample Videos\Wildlife.wmv" -an -sn -c:v bmp -pix_fmt bgr24 -f rawvideo - > junk.bin

    it works fine. However, when I spawn the exact same thing (minus > junk.bin) I get this nasty "bad header" error after a few seconds of playback. What is causing this ? I have trouble believing my process blocks the pipe longer than the filesystem does, but it should be able to block the pipe indefinitely without defeating the decoding. The truncated stderr is below. My code to spawn the thing is here.

    ffmpeg version N-60761-g916a792 Copyright (c) 2000-2014 the FFmpeg developers
     built on Feb 19 2014 21:57:22 with gcc 4.8.2 (GCC)
     configuration: --target-os=mingw32 --enable-shared --enable-runtime-cpudetect
     libavutil      52. 65.100 / 52. 65.100
     libavcodec     55. 52.102 / 55. 52.102
     libavformat    55. 33.100 / 55. 33.100
     libavdevice    55. 10.100 / 55. 10.100
     libavfilter     4.  1.103 /  4.  1.103
     libswscale      2.  5.101 /  2.  5.101
     libswresample   0. 17.104 /  0. 17.104
    cygwin warning:
     MS-DOS style path detected: C:\Users\Public\Videos\Sample Videos\Wildlife.wmv
     Preferred POSIX equivalent is: /cygdrive/c/Users/Public/Videos/Sample Videos/Wildlife.wmv
     CYGWIN environment variable option "nodosfilewarning" turns off this warning.
     Consult the user's guide for more details about POSIX paths:
       http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
    [asf @ 0x600059480] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, asf, from 'C:\Users\Public\Videos\Sample Videos\Wildlife.wmv':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : © 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
     Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s
       Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp, 192 kb/s
       Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
    Output #0, rawvideo, to 'pipe:':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : © 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
       encoder         : Lavf55.33.100
       Stream #0:0(eng): Video: bmp, bgr24, 1280x720, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Stream mapping:
     Stream #0:1 -> #0:0 (vc1 -> bmp)
    Press [q] to stop, [?] for help
    frame=    3 fps=0.0 q=0.0 size=    8100kB time=00:00:00.10 bitrate=662902.1kbits/s    
    frame=   29 fps= 26 q=0.0 size=   78302kB time=00:00:00.96 bitrate=662902.3kbits/s    
    frame=   50 fps= 30 q=0.0 size=  135003kB time=00:00:01.66 bitrate=662902.2kbits/s    
    frame=   65 fps= 30 q=0.0 size=  175503kB time=00:00:02.16 bitrate=662902.2kbits/s    
    frame=   80 fps= 30 q=0.0 size=  216004kB time=00:00:02.66 bitrate=662902.1kbits/s    
    frame=   95 fps= 30 q=0.0 size=  256505kB time=00:00:03.16 bitrate=662902.1kbits/s    
    [asf @ 0x600059480] ff asf bad header 74  at:5053733
    [asf @ 0x600059480] invalid packet_length -1908511255 at:5053740
    [asf @ 0x600059480] ff asf bad header d4  at:5053759
    [asf @ 0x600059480] ff asf skip 55629 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5181733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5189733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5197733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5205733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5213733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5221733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5229733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5237733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5245733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5357733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5365733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5373733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5381733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5493733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5501733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5509733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5517733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5629733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5637733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5645733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5653733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5701733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5709733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5717733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5725733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5805733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5813733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5821733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5829733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5877733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5885733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5893733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5901733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5949733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5957733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5965733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] ff asf bad header 0  at:5973733
    [asf @ 0x600059480] ff asf skip 7991 (unknown stream)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 15 times
    [asf @ 0x600059480] unexpected packet_replic_size of 2
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 7 times
    [asf @ 0x600059480] ff asf skip 2562 (unknown stream)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 3 times
    [asf @ 0x600059480] ff asf skip 448 (unknown stream)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 9 times
    [asf @ 0x600059480] unexpected packet_replic_size of 6
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 7 times
    [asf @ 0x600059480] packet_frag_size is invalid (1749-9)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 13 times
    [asf @ 0x600059480] packet_frag_size is invalid (1749-9)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 24 times
    [asf @ 0x600059480] unexpected packet_replic_size of 6
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 6 times
    [asf @ 0x600059480] unexpected packet_replic_size of 5
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 6 times
    [asf @ 0x600059480] packet_frag_size is invalid (1749-9)
    [asf @ 0x600059480] packet_obj_size invalid
    [asf @ 0x600059480] packet_frag_size is invalid (1749-9)
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 2 times
    [asf @ 0x600059480] unexpected packet_replic_size of 5
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 8 times
    [asf @ 0x600059480] unexpected packet_replic_size of 5
    [asf @ 0x600059480] packet_obj_size invalid
       Last message repeated 39 times
    [asf @ 0x600059480] packet_frag_size is invalid (1749-40)
  • FFmpeg - downmixing FLAC 6.1 to AAC 5.1

    7 juillet 2014, par Martijn

    I can’t seem to figure out how to do this. I’ve been staring at these commands :
    https://trac.ffmpeg.org/wiki/AudioChannelManipulation

    But to no avail. It’s a tad above my level, sadly. Here’s the ffmpeg -i output for the video in question :

    ffmpeg version N-64012-g61df081 Copyright (c) 2000-2014 the FFmpeg developers
     built on Jun 16 2014 22:01:59 with gcc 4.8.3 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex--enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
     libavutil      52. 89.100 / 52. 89.100
     libavcodec     55. 67.100 / 55. 67.100
     libavformat    55. 43.100 / 55. 43.100
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  8.100 /  4.  8.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, matroska,webm, from '[Coalgirls]_Spirited_Away_(1920x1038_Blu-ray_FLAC)_[92372194].mkv':
     Metadata:
       title           : Spirited Away
       encoder         : libebml v1.3.0 + libmatroska v1.4.0
       creation_time   : 2014-07-03 01:32:13
     Duration: 02:04:32.29, start: 0.000000, bitrate: 15972 kb/s
       Chapter #0.0: start 0.000000, end 99.099000
       Metadata:
         title           : 00:00:00.000
       Chapter #0.1: start 99.099000, end 196.238000
       Metadata:
         title           : 00:01:39.099
       Chapter #0.2: start 196.238000, end 443.526000
       Metadata:
         title           : 00:03:16.238
       Chapter #0.3: start 443.526000, end 645.395000
       Metadata:
         title           : 00:07:23.526
       Chapter #0.4: start 645.395000, end 1023.022000
       Metadata:
         title           : 00:10:45.395
       Chapter #0.5: start 1023.022000, end 1368.534000
       Metadata:
         title           : 00:17:03.022
       Chapter #0.6: start 1368.534000, end 1716.048000
       Metadata:
         title           : 00:22:48.534
       Chapter #0.7: start 1716.048000, end 2008.173000
       Metadata:
         title           : 00:28:36.048
       Chapter #0.8: start 2008.173000, end 2301.674000
       Metadata:
         title           : 00:33:28.173
       Chapter #0.9: start 2301.674000, end 2651.816000
       Metadata:
         title           : 00:38:21.674
       Chapter #0.10: start 2651.816000, end 2906.821000
       Metadata:
         title           : 00:44:11.816
       Chapter #0.11: start 2906.821000, end 3271.351000
       Metadata:
         title           : 00:48:26.821
       Chapter #0.12: start 3271.351000, end 3729.017000
       Metadata:
         title           : 00:54:31.351
       Chapter #0.13: start 3729.017000, end 4091.587000
       Metadata:
         title           : 01:02:09.017
       Chapter #0.14: start 4091.587000, end 4476.847000
       Metadata:
         title           : 01:08:11.587
       Chapter #0.15: start 4476.847000, end 4750.579000
       Metadata:
         title           : 01:14:36.847
       Chapter #0.16: start 4750.579000, end 5139.760000
       Metadata:
         title           : 01:19:10.579
       Chapter #0.17: start 5139.760000, end 5478.890000
       Metadata:
         title           : 01:25:39.760
       Chapter #0.18: start 5478.890000, end 5853.806000
       Metadata:
         title           : 01:31:18.890
       Chapter #0.19: start 5853.806000, end 6318.937000
       Metadata:
         title           : 01:37:33.806
       Chapter #0.20: start 6318.937000, end 6625.118000
       Metadata:
         title           : 01:45:18.937
       Chapter #0.21: start 6625.118000, end 6771.098000
       Metadata:
         title           : 01:50:25.118
       Chapter #0.22: start 6771.098000, end 6914.199000
       Metadata:
         title           : 01:52:51.098
       Chapter #0.23: start 6914.199000, end 7253.580000
       Metadata:
         title           : 01:55:14.199
       Chapter #0.24: start 7253.580000, end 7472.288000
       Metadata:
         title           : 02:00:53.580
       Stream #0:0: Video: h264 (High 10), yuv420p10le(tv, bt709), 1920x1038, SAR 1:1 DAR 320:173, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
       Metadata:
         title           : Spirited Away
       Stream #0:1(jpn): Audio: flac, 48000 Hz, 6.1, s32 (default)
       Metadata:
         title           : 6.1 FLAC
       Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:3(fre): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:4(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:5(fin): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         title           : 2.0 AC3
       Stream #0:6(kor): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:7(chi): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:8(chi): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:9(eng): Subtitle: ssa (default)
       Metadata:
         title           : English
       Stream #0:10(fre): Subtitle: ssa
       Metadata:
         title           : French
       Stream #0:11(ger): Subtitle: ssa
       Metadata:
         title           : German
       Stream #0:12(eng): Subtitle: ssa
       Metadata:
         title           : Songs + Signs
       Stream #0:13: Attachment: ttf
       Metadata:
         filename        : MyriadPro-Regular.otf
         mimetype        : application/x-truetype-font
       Stream #0:14: Attachment: ttf
       Metadata:
         filename        : MyriadPro-SemiboldIt.otf
         mimetype        : application/x-truetype-font
       Stream #0:15: Attachment: ttf
       Metadata:
         filename        : Vesta-Bold.otf
         mimetype        : application/x-truetype-font
       Stream #0:16: Attachment: ttf
       Metadata:
         filename        : Vesta-Bold_2.otf
         mimetype        : application/x-truetype-font
       Stream #0:17: Attachment: ttf
       Metadata:
         filename        : AR CENA_0.TTF
         mimetype        : application/x-truetype-font
       Stream #0:18: Attachment: ttf
       Metadata:
         filename        : tahomabd.ttf
         mimetype        : application/x-truetype-font
       Stream #0:19: Attachment: ttf
       Metadata:
         filename        : palai.ttf
         mimetype        : application/x-truetype-font
       Stream #0:20: Attachment: ttf
       Metadata:
         filename        : pala.ttf
         mimetype        : application/x-truetype-font

    As you can see, one of the streams is a FLAC 6.1 stream. I wanted to convert that to AAC, and I know how to do that, basically like this :

    ffmpeg -i "input.mkv" -codec:v copy -codec:a aac -strict -2 -b:a 320k -f matroska "output.mkv"

    But apparently AAC doesn’t support 6.1 audio :

    ...
    [aac @ 03b26860] Unsupported number of channels: 7
    Output #0, matroska, to 'd:\Movies\[Coalgirls]_Spirited_Away_(1920x1038_Blu-ray_FLAC)_[92372194].aac.mkv':
       Stream #0:0(jpn): Video: h264, yuv420p10le, 1920x1038 [SAR 1:1 DAR 320:173], q=2-31, 23.98 fps, 90k tbn, 1k tbc (default)
       Stream #0:1(jpn): Audio: aac, 0 channels, 128 kb/s (default)
       Metadata:
         encoder         : Lavc55.67.100 aac
       Stream #0:2(eng): Subtitle: ssa, 128 kb/s (default)
       Metadata:
         encoder         : Lavc55.67.100 ssa
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (flac (native) -> aac (aac))
     Stream #0:9 -> #0:2 (ssa (native) -> ssa (native))
    Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

    That’s fine, so I wanted to downmix it to 5.1 and encode as AAC. But I can’t seem to work out how to. Any advice ?