Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (55)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (10988)

  • Audio HLS with metadata on Mac from directory of mp3 files ?

    2 février 2017, par eagspoo

    I’m trying to create HLS output (m3u8 file + many .ts files) from a list of mp3 files where the mp3 id3 metadata is preserved in the HLS output.

    I’ve been trying ffmpeg like this :

    ffmpeg -f concat -i list.txt -hls_init_time 2 -hls_time 2 out.m3u8

    where list.txt contains :

    file 01.mp3
    file 02.mp3
    file 03.mp3
    file 04.mp3
    file 05.mp3
    file 06.mp3
    file 07.mp3
    file 08.mp3
    file 09.mp3
    file 10.mp3

    The result is a single out.m3u8 file and a single very large out0.ts file. I was expecting about 1500 ts files and an m3u8 file that contains the last 5 ts files.

    I’m completely new to ffmpeg and honestly I don’t want to learn it in depth right now.

    Does anyone know how to do this either with ffmpeg or otherwise ?

    ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
     libavutil      55. 34.100 / 55. 34.100
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.100 / 57. 56.100
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, concat, from 'list.txt':
     Duration: N/A, start: -0.025056, bitrate: 238 kb/s
       Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 238 kb/s
       Metadata:
         encoder         : LAME3.99r
       Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 700x700 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
       Metadata:
         title           : cover
         comment         : Cover (front)
    [hls @ 0x7fc50f01aa00] Frame rate very high for a muxer not efficiently supporting it.
    Please consider specifying a lower framerate, a different muxer or -vsync 2
    No pixel format specified, yuvj444p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x7fc50f00dc00] using SAR=1/1
    [libx264 @ 0x7fc50f00dc00] MB rate (174240000) > level limit (2073600)
    [libx264 @ 0x7fc50f00dc00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x7fc50f00dc00] profile High 4:4:4 Predictive, level 5.2, 4:4:4 8-bit
    Output #0, hls, to 'out.m3u8':
     Metadata:
       encoder         : Lavf57.56.100
       Stream #0:0: Video: h264 (libx264), yuvj444p(pc), 700x700 [SAR 72:72 DAR 1:1], q=-1--1, 90k fps, 90k tbn, 90k tbc
       Metadata:
         title           : cover
         comment         : Cover (front)
         encoder         : Lavc57.64.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
       Metadata:
         encoder         : Lavc57.64.101 aac
    Stream mapping:
     Stream #0:1 -> #0:0 (mjpeg (native) -> h264 (libx264))
     Stream #0:0 -> #0:1 (mp3 (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame= 2256 fps=389 q=33.0 size=N/A time=00:00:00.02 bitrate=N/A dup=2255 drop=0 speed=0.00422x    
    frame= 2256 fps=358 q=33.0 size=N/A time=00:00:08.98 bitrate=N/A dup=2255 drop=0 speed=1.43x    
    frame= 2256 fps=332 q=33.0 size=N/A time=00:00:26.75 bitrate=N/A dup=2255 drop=0 speed=3.94x    
    frame= 2256 fps=309 q=33.0 size=N/A time=00:00:49.64 bitrate=N/A dup=2255 drop=0 speed=6.81x    
    frame= 2256 fps=289 q=33.0 size=N/A time=00:01:14.39 bitrate=N/A dup=2255 drop=0 speed=9.54x    
    frame= 2256 fps=272 q=33.0 size=N/A time=00:01:38.77 bitrate=N/A dup=2255 drop=0 speed=11.9x    
    frame= 2257 fps=257 q=33.0 size=N/A time=00:01:58.98 bitrate=N/A dup=2255 drop=0 speed=13.5x    
    frame= 2257 fps=243 q=33.0 size=N/A time=00:02:19.02 bitrate=N/A dup=2255 drop=0 speed=  15x    
    frame= 2257 fps=230 q=33.0 size=N/A time=00:02:38.64 bitrate=N/A dup=2255 drop=0 speed=16.2x    
    frame= 2257 fps=219 q=33.0 size=N/A time=00:03:00.61 bitrate=N/A dup=2255 drop=0 speed=17.5x    
    frame= 2257 fps=209 q=33.0 size=N/A time=00:03:20.81 bitrate=N/A dup=2255 drop=0 speed=18.6x    
    frame= 2257 fps=200 q=33.0 size=N/A time=00:03:44.28 bitrate=N/A dup=2255 drop=0 speed=19.9x    
    frame= 2257 fps=191 q=33.0 size=N/A time=00:04:06.90 bitrate=N/A dup=2255 drop=0 speed=20.9x    
    frame= 2257 fps=184 q=33.0 size=N/A time=00:04:30.33 bitrate=N/A dup=2255 drop=0 speed=  22x    
    frame= 2257 fps=176 q=33.0 size=N/A time=00:04:53.57 bitrate=N/A dup=2255 drop=0 speed=22.9x    
    frame= 2258 fps=170 q=33.0 size=N/A time=00:05:07.95 bitrate=N/A dup=2255 drop=0 speed=23.2x    
    frame= 2258 fps=164 q=33.0 size=N/A time=00:05:20.44 bitrate=N/A dup=2255 drop=0 speed=23.2x    
    frame= 2258 fps=158 q=33.0 size=N/A time=00:05:33.79 bitrate=N/A dup=2255 drop=0 speed=23.3x    
    frame= 2258 fps=153 q=33.0 size=N/A time=00:05:46.77 bitrate=N/A dup=2255 drop=0 speed=23.4x    
    frame= 2258 fps=148 q=33.0 size=N/A time=00:05:59.87 bitrate=N/A dup=2255 drop=0 speed=23.5x    
    frame= 2258 fps=143 q=33.0 size=N/A time=00:06:14.54 bitrate=N/A dup=2255 drop=0 speed=23.7x    
    frame= 2258 fps=138 q=33.0 size=N/A time=00:06:28.27 bitrate=N/A dup=2255 drop=0 speed=23.8x    
    frame= 2258 fps=134 q=33.0 size=N/A time=00:06:42.92 bitrate=N/A dup=2255 drop=0 speed=  24x    
    frame= 2258 fps=130 q=33.0 size=N/A time=00:06:56.57 bitrate=N/A dup=2255 drop=0 speed=24.1x    
    frame= 2258 fps=127 q=33.0 size=N/A time=00:07:10.16 bitrate=N/A dup=2255 drop=0 speed=24.2x    
    frame= 2258 fps=123 q=33.0 size=N/A time=00:07:25.04 bitrate=N/A dup=2255 drop=0 speed=24.3x    
    frame= 2258 fps=120 q=33.0 size=N/A time=00:07:39.41 bitrate=N/A dup=2255 drop=0 speed=24.4x    
    frame= 2258 fps=117 q=33.0 size=N/A time=00:07:55.57 bitrate=N/A dup=2255 drop=0 speed=24.6x    
    frame= 2258 fps=114 q=33.0 size=N/A time=00:08:12.64 bitrate=N/A dup=2255 drop=0 speed=24.9x    
    frame= 2258 fps=111 q=33.0 size=N/A time=00:08:30.24 bitrate=N/A dup=2255 drop=0 speed=25.1x    
    frame= 2259 fps=109 q=33.0 size=N/A time=00:08:46.00 bitrate=N/A dup=2255 drop=0 speed=25.3x    
    frame= 2259 fps=106 q=33.0 size=N/A time=00:09:03.14 bitrate=N/A dup=2255 drop=0 speed=25.5x    
    [aac @ 0x7fc50f00f400] Queue input is backward in time
    [hls @ 0x7fc50f01aa00] Non-monotonous DTS in output stream 0:1; previous: 49402501, current: 36948720; changing to 49402502. This may result in incorrect timestamps in the output file.

    ... about 25000 lines of this...

    frame= 2261 fps= 65 q=33.0 size=N/A time=00:09:08.93 bitrate=N/A dup=2255 drop=0 speed=15.8x    
    [hls @ 0x7fc50f01aa00] Non-monotonous DTS in output stream 0:1; previous: 49402502, current: 36950810; changing to 49402503. This may result in incorrect timestamps in the output file.
    [hls @ 0x7fc50f01aa00] Non-monotonous DTS in output stream 0:1; previous: 49408463, current: 49408084; changing to 49408464. This may result in incorrect timestamps in the output file.
    frame= 2261 fps= 59 q=33.0 size=N/A time=00:09:13.11 bitrate=N/A dup=2255 drop=0 speed=14.4x    
    frame= 2261 fps= 58 q=33.0 size=N/A time=00:09:30.15 bitrate=N/A dup=2255 drop=0 speed=14.7x    
    frame= 2262 fps= 57 q=33.0 size=N/A time=00:09:50.68 bitrate=N/A dup=2255 drop=0 speed=  15x    
    frame= 2262 fps= 57 q=33.0 size=N/A time=00:10:04.10 bitrate=N/A dup=2255 drop=0 speed=15.2x    
    frame= 2262 fps= 56 q=33.0 size=N/A time=00:10:20.52 bitrate=N/A dup=2255 drop=0 speed=15.4x    
    frame= 2262 fps= 55 q=33.0 size=N/A time=00:10:36.66 bitrate=N/A dup=2255 drop=0 speed=15.6x    
    frame= 2262 fps= 55 q=33.0 size=N/A time=00:10:52.31 bitrate=N/A dup=2255 drop=0 speed=15.8x    
    frame= 2262 fps= 54 q=33.0 size=N/A time=00:11:09.35 bitrate=N/A dup=2255 drop=0 speed=  16x    
    frame= 2262 fps= 53 q=33.0 size=N/A time=00:11:26.37 bitrate=N/A dup=2255 drop=0 speed=16.2x    
    frame= 2262 fps= 53 q=33.0 size=N/A time=00:11:43.44 bitrate=N/A dup=2255 drop=0 speed=16.4x    
    frame= 2262 fps= 52 q=33.0 size=N/A time=00:11:59.93 bitrate=N/A dup=2255 drop=0 speed=16.6x    
    frame= 2262 fps= 52 q=33.0 size=N/A time=00:12:15.48 bitrate=N/A dup=2255 drop=0 speed=16.8x    
    frame= 2262 fps= 51 q=33.0 size=N/A time=00:12:28.44 bitrate=N/A dup=2255 drop=0 speed=16.9x    
    frame= 2262 fps= 50 q=33.0 size=N/A time=00:12:43.93 bitrate=N/A dup=2255 drop=0 speed=  17x    
    frame= 2262 fps= 50 q=33.0 size=N/A time=00:12:59.30 bitrate=N/A dup=2255 drop=0 speed=17.2x    
    frame= 2263 fps= 49 q=33.0 size=N/A time=00:13:15.93 bitrate=N/A dup=2255 drop=0 speed=17.4x    
    frame= 2263 fps= 49 q=33.0 size=N/A time=00:13:41.70 bitrate=N/A dup=2255 drop=0 speed=17.7x    
    frame= 2263 fps= 48 q=33.0 size=N/A time=00:14:02.65 bitrate=N/A dup=2255 drop=0 speed=  18x    
    frame= 2263 fps= 48 q=33.0 size=N/A time=00:14:25.57 bitrate=N/A dup=2255 drop=0 speed=18.3x    
    frame= 2263 fps= 47 q=33.0 size=N/A time=00:14:49.34 bitrate=N/A dup=2255 drop=0 speed=18.6x    
    frame= 2263 fps= 47 q=33.0 size=N/A time=00:15:11.17 bitrate=N/A dup=2255 drop=0 speed=18.8x    
    frame= 2263 fps= 46 q=33.0 size=N/A time=00:15:31.60 bitrate=N/A dup=2255 drop=0 speed=19.1x    
    frame= 2263 fps= 46 q=33.0 size=N/A time=00:15:47.25 bitrate=N/A dup=2255 drop=0 speed=19.2x    
    frame= 2263 fps= 45 q=33.0 size=N/A time=00:16:03.30 bitrate=N/A dup=2255 drop=0 speed=19.3x    
    frame= 2263 fps= 45 q=33.0 size=N/A time=00:16:22.99 bitrate=N/A dup=2255 drop=0 speed=19.5x    
    frame= 2263 fps= 45 q=33.0 size=N/A time=00:16:45.12 bitrate=N/A dup=2255 drop=0 speed=19.8x    
    frame= 2264 fps= 44 q=33.0 size=N/A time=00:17:05.99 bitrate=N/A dup=2255 drop=0 speed=  20x    
    frame= 2264 fps= 44 q=33.0 size=N/A time=00:17:25.03 bitrate=N/A dup=2255 drop=0 speed=20.2x    
    frame= 2264 fps= 43 q=33.0 size=N/A time=00:17:43.12 bitrate=N/A dup=2255 drop=0 speed=20.3x    
    frame= 2264 fps= 43 q=33.0 size=N/A time=00:18:01.35 bitrate=N/A dup=2255 drop=0 speed=20.5x    
    frame= 2264 fps= 42 q=33.0 size=N/A time=00:18:17.79 bitrate=N/A dup=2255 drop=0 speed=20.6x    
    frame= 2264 fps= 42 q=33.0 size=N/A time=00:18:35.15 bitrate=N/A dup=2255 drop=0 speed=20.7x    
    frame= 2264 fps= 42 q=33.0 size=N/A time=00:18:55.82 bitrate=N/A dup=2255 drop=0 speed=20.9x    
    frame= 2264 fps= 41 q=33.0 size=N/A time=00:19:17.46 bitrate=N/A dup=2255 drop=0 speed=21.1x    
    frame= 2264 fps= 41 q=33.0 size=N/A time=00:19:28.37 bitrate=N/A dup=2255 drop=0 speed=21.1x    
    frame= 2264 fps= 41 q=33.0 size=N/A time=00:19:42.21 bitrate=N/A dup=2255 drop=0 speed=21.2x    
    frame= 2264 fps= 40 q=33.0 size=N/A time=00:20:03.11 bitrate=N/A dup=2255 drop=0 speed=21.3x    
    frame= 2264 fps= 40 q=33.0 size=N/A time=00:20:20.36 bitrate=N/A dup=2255 drop=0 speed=21.5x    
    frame= 2264 fps= 39 q=33.0 size=N/A time=00:20:38.57 bitrate=N/A dup=2255 drop=0 speed=21.6x    
    frame= 2265 fps= 39 q=33.0 size=N/A time=00:20:55.79 bitrate=N/A dup=2255 drop=0 speed=21.7x    
    frame= 2265 fps= 39 q=33.0 size=N/A time=00:21:13.81 bitrate=N/A dup=2255 drop=0 speed=21.8x    
    frame= 2265 fps= 38 q=33.0 size=N/A time=00:21:28.48 bitrate=N/A dup=2255 drop=0 speed=21.9x    
    frame= 2265 fps= 38 q=33.0 size=N/A time=00:21:41.53 bitrate=N/A dup=2255 drop=0 speed=21.9x    
    frame= 2265 fps= 38 q=33.0 size=N/A time=00:21:54.44 bitrate=N/A dup=2255 drop=0 speed=  22x    
    frame= 2265 fps= 38 q=33.0 size=N/A time=00:22:09.35 bitrate=N/A dup=2255 drop=0 speed=  22x    
    frame= 2265 fps= 37 q=33.0 size=N/A time=00:22:23.84 bitrate=N/A dup=2255 drop=0 speed=22.1x    
    frame= 2265 fps= 37 q=33.0 size=N/A time=00:22:40.98 bitrate=N/A dup=2255 drop=0 speed=22.2x    
    frame= 2265 fps= 37 q=33.0 size=N/A time=00:22:59.99 bitrate=N/A dup=2255 drop=0 speed=22.3x    
    frame= 2265 fps= 36 q=33.0 size=N/A time=00:23:21.29 bitrate=N/A dup=2255 drop=0 speed=22.5x    
    frame= 2265 fps= 36 q=33.0 size=N/A time=00:23:37.96 bitrate=N/A dup=2255 drop=0 speed=22.6x    
    frame= 2265 fps= 36 q=33.0 size=N/A time=00:23:53.49 bitrate=N/A dup=2255 drop=0 speed=22.6x    
    frame= 2265 fps= 35 q=33.0 size=N/A time=00:24:10.42 bitrate=N/A dup=2255 drop=0 speed=22.7x    
    frame= 2265 fps= 35 q=33.0 size=N/A time=00:24:29.64 bitrate=N/A dup=2255 drop=0 speed=22.8x    
    frame= 2265 fps= 35 q=33.0 size=N/A time=00:24:52.61 bitrate=N/A dup=2255 drop=0 speed=  23x    
    frame= 2265 fps= 35 q=-1.0 Lsize=N/A time=00:25:02.45 bitrate=N/A dup=2255 drop=0 speed=  23x    
    video:1482kB audio:33826kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [libx264 @ 0x7fc50f00dc00] frame I:10    Avg QP:21.37  size:145718
    [libx264 @ 0x7fc50f00dc00] frame P:571   Avg QP:21.23  size:    31
    [libx264 @ 0x7fc50f00dc00] frame B:1684  Avg QP:30.33  size:    25
    [libx264 @ 0x7fc50f00dc00] consecutive B-frames:  0.8%  0.1%  0.0% 99.1%
    [libx264 @ 0x7fc50f00dc00] mb I  I16..4:  0.0% 98.3%  1.7%
    [libx264 @ 0x7fc50f00dc00] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
    [libx264 @ 0x7fc50f00dc00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 0.0% L1:100.0% BI: 0.0%
    [libx264 @ 0x7fc50f00dc00] 8x8 transform intra:98.3% inter:100.0%
    [libx264 @ 0x7fc50f00dc00] coded y,u,v intra: 100.0% 70.2% 62.8% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x7fc50f00dc00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 18% 39%  5%  4%  4%  6%  6% 10%
    [libx264 @ 0x7fc50f00dc00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 12% 15%  9%  8% 10%  9%  9% 11%
    [libx264 @ 0x7fc50f00dc00] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7fc50f00dc00] ref P L0: 11.6% 79.1%  9.3%
    [libx264 @ 0x7fc50f00dc00] ref B L1: 50.0% 50.0%
    [libx264 @ 0x7fc50f00dc00] kb/s:482409.22
    [aac @ 0x7fc50f00f400] Qavg: 491.256
  • Saying Goodbye To Old Machines

    1er décembre 2014, par Multimedia Mike — General, powerpc, via

    I recently sent a few old machines off for recycling. Both had relevance to the early days of the FATE testing effort. As is my custom, I photographed them (poorly, of course).

    First, there’s the PowerPC-based Mac Mini I procured thanks to a Craigslist ad in late 2006. I had plans to develop automated FFmpeg building and testing and was already looking ahead toward testing multiple CPU architectures. Again, this was 2006 and PowerPC wasn’t completely on the outs yet– although Apple’s MacTel transition was in full swing, the entire new generation of video game consoles was based on PowerPC.


    PPC Mac Mini pieces

    Click for larger image


    I remember trying to find a Mac Mini PPC on Craigslist. Many were to be found, but all asked more than the price of even a new Mac Mini Intel, always because the seller was leaving all of last year’s applications and perhaps including a monitor, neither of which I needed. Fortunately, I found this bare Mac Mini. Also fortunate was the fact that it was far easier to install Linux on it than the first PowerPC machine I owned.

    After FATE operation transitioned away from me, I still kept the machine in service as an edge server and automated backup machine. That is, until the hard drive failed on reboot one day. Thus, when it was finally time to recycle the computer, I felt it necessary to disassemble the machine and remove the hard drive for possible salvage and then for destruction.

    If you’ve ever attempted to upgrade or otherwise service this style of Mac Mini, you will no doubt recognize the pictured paint scraper tool as standard kit. I have had that tool since I first endeavored to upgrade the RAM to 1 GB from the standard 1/2 GB. Performing such activities on a Mac Mini is tedious, but only if you care about putting it back together afterwards.

    The next machine is a bit older. I put it together nearly a decade ago, early in 2005. This machine’s original duty was “download agent”– this would be more specifically called a BitTorrent machine in modern tech parlance. Back then, I placed it on someone else’s woefully underutilized home broadband connection (with their permission, of course) when I was too cheap to upgrade from dialup.


    VIA small form factor front

    Click for larger image


    This is a small form factor system from VIA that was clearly designed with home theater PC (HTPC) use cases in mind. It has a VIA C3 x86-compatible CPU (according to my notes, Centaur VIA Samuel 2 stepping 03, flags : fpu de tsc msr cx8 mtrr pge mmx 3dnow) and 128 MB of RAM (initially ; I upgraded it to 512 MB some years later, just for the sake of doing it). And then there was the 120 GB PATA HD for all that downloaded goodness.


    VIA machine small form factor inside

    Click for larger image


    I have specific memories of a time when my main computer at home wasn’t working correctly for one reason or another. Instead, I logged into this machine remotely via SSH to make several optimizations and fixes on FFmpeg’s VP3/Theora video decoder, all from the terminal, without being able to see the decoded images with my own eyes (which is why I insist that even blind people could work on video codecs).

    By the time I got my own broadband, I had become inspired to attempt the automated build and test system for FFmpeg. This was the machine I used for prototyping early brainstorms of FATE. By the time I put a basic build/test system into place in early 2008, I had much faster computers that could build and test the project– obvious limitation of this machine is that it could take at least 1/2 hour to build the entire codebase, and that was the project from 8 years ago.

    So the machine got stuffed in a closet somewhere along the line. The next time I pulled it out was in 2010 when I wanted to toy with Dreamcast programming once more (the machine appears in one of the photos in this post). This was the only machine I still owned which still had an RS-232 serial port (I didn’t know much about USB serial converters yet), plus it still had a bunch of pre-compiled DC homebrew binaries (I was having trouble getting the toolchain to work right).

    The next time I dusted off this machine was late last year when I was trying some experiments with the Microsoft Xbox’s IDE drive (a photo in that post also shows the machine ; this thing shows up a lot on this blog). The VIA machine was the only machine I still owned which had 40-pin IDE connectors which was crucial to my experiment.

    At this point, I was trying to make the machine more useful which meant replacing the ancient Gentoo Linux distribution as well as simply interacting with it via a keyboard and mouse. I have a long Evernote entry documenting a comedy of errors revolving around this little box. The interaction troubles were due to the fact that I didn’t have any PS/2 keyboards left and I couldn’t make a USB keyboard work with it. Diego was able to explain that I needed to flip a bit in the BIOS to address this which worked. As for upgrading the OS, I tried numerous Linux distributions large and small, mostly focusing on the small. None worked. I eventually learned that, while I was trying to use i686 distributions, this machine did not actually qualify as an i686 CPU ; installations usually booted but failed because the default kernel required the cmov instruction. I was advised to try i386 distros instead. My notes don’t indicate whether I had any luck on this front before I gave up and moved on.

    I just made the connection that this VIA machine has two 40-pin IDE connectors which means that the thing was technically capable of supporting up to 4 IDE devices. Obviously, the computer couldn’t really accommodate that in terms of space or power. When I wanted to try installing a new OS, I needed take off the top and connect a rather bulky IDE CD-ROM drive. This computer’s casing was supposed to be able to support a slimline optical drive (perhaps like the type found in laptops), but I could never quite visualize how that was supposed to work, space-wise. When I disassembled the PowerPC Mac Mini, I realized I might be able to repurpose that machines optical drive for this computer. Obviously, I thought better of trying since both machines are off to the recycle pile.

    I would still like to work on the Xbox project a bit more, but I procured a different, unused, much more powerful yet still old computer that has a motherboard with 1 PATA connector in addition to 6 SATA connectors. If I ever get around to toying with Linux kernel development, this should be a much more appropriate platform to use.

    I thought about turning this machine into an old Windows XP (and lower, down to Windows 3.1) gaming platform ; the capabilities of the machine would probably be perfect for a huge portion of my Windows game collection. But I think the lack of an optical drive renders this idea intractable. External USB drives are likely out of the question since there is very little chance that this motherboard featured USB 2.0 (the specs don’t mention 2.0, so the USB ports are probably 1.1).

    So it is with fond memories that I send off both machines, sans hard drives, to the recycle pile. I’m still deciding on an appropriate course of action for failed hard drives, though.

  • Subtitling Sierra VMD Files

    1er juin 2016, par Multimedia Mike — Game Hacking

    I was contacted by a game translation hobbyist from Spain (henceforth known as The Translator). He had set his sights on Sierra’s 7-CD Phantasmagoria. This mammoth game was driven by a lot of FMV files and animations that have speech. These require language translation in the form of video subtitling. He’s lucky that he found possibly the one person on the whole internet who has just the right combination of skill, time, and interest to pull this off. And why would I care about helping ? I guess I share a certain camaraderie with game hackers. Don’t act so surprised. You know what kind of stuff I like to work on.

    The FMV format used in this game is VMD, which makes an appearance in numerous Sierra titles. FFmpeg already supports decoding this format. FFmpeg also supports subtitling video. So, ideally, all that’s necessary to support this goal is to add a muxer for the VMD format which can encode raw video and audio, which the format supports. Implement video compression as extra credit.

    The pipeline that I envisioned looks like this :


    VMD Subtitling Process

    VMD Subtitling Process


    “Trivial !” I surmised. I just never learn, do I ?

    The Plan
    So here’s my initial pitch, outlining the work I estimated that I would need to do towards the stated goal :

    1. Create a new file muxer that produces a syntactically valid VMD file with bogus video and audio data. Make sure it works with both FFmpeg’s playback system as well as the proper Phantasmagoria engine.
    2. Create a new video encoder that essentially operates in pass-through mode while correctly building a palette.
    3. Create a new basic encoder for the video frames.

    A big unknown for me was exactly how subtitle handling operates in FFmpeg. Thanks to this project, I now know. I was concerned because I was pretty sure that font rendering entails anti-aliasing which bodes poorly for keeping the palette count under 256 unique colors.

    Computer Science Puzzle
    When pondering how to process the palette, I was excited for the opportunity to exercise actual computer science. FFmpeg converts frames from paletted frames to full RGB frames. Then it needs to convert them back to paletted frames. I had a vague recollection of solving this problem once before when I was experimenting with a new paletted video codec. I seem to recall that I did the palette conversion in a very naive manner. I just used a static 256-element array and processed each RGB pixel of the frame, seeing if the value already occurred in the table (O(n) lookup) and adding it otherwise.

    There are more efficient algorithms, however, such as hash tables and trees. Somewhere along the line, FFmpeg helpfully acquired a rarely-used tree data structure, which was perfect for this project.

    So I was pretty pleased with this optimization. Too bad this wouldn’t survive to the end of the effort.

    Another palette-related challenge was the fact that a group of pictures would be accumulating a new palette but that palette needed to be recorded before the group. Thus, the muxer needed to have extra logic to rewind the file when the video encoder transmitted a palette change.

    Video Compression
    VMD has a few methods in its compression toolbox. It can use interframe differencing, it has some RLE, or it can code a frame raw. It can also use a custom LZ-like format on top of these. For early prototypes, I elected to leave each frame coded raw. After the concept was proved, I implemented the frame differencing.


    VMD frame #1

    VMD frame #2

    VMD frame difference
    Top frame compared with the middle frame yields the bottom frame : red pixels indicate changes

    Encoding only those red dots in between vast runs of unchanged pixels yielded a vast measurable improvement. The next step was to try wiring up FFmpeg’s existing LZ compression facilities to the encoder. This turned out to be implausible since VMD’s LZ variant has nothing to do with anything FFmpeg already provides. Fortunately, the LZ piece is not absolutely required and the frame differencing + RLE provides plenty of compression.

    Subtitling
    I’ve never done anything, multimedia programming-wise, concerning subtitles. I guess all the entertainment I care about has always been in my native tongue. What a good excuse to program outside of my comfort zone !

    First, I needed to know how to access FFmpeg’s subtitling facilities. Fortunately, The Translator did the legwork on this matter so I didn’t have to figure it out.

    However, I intuitively had misgivings about this phase. I had heard that the subtitling process performs anti-aliasing. That means that the image would need to be promoted to a higher colorspace for this phase and that the anti-aliasing process would likely push the color count way past 256. Some quick tests revealed this to be the case, as the running color count would leap by several hundred colors as soon as the palette accounting algorithm encountered a subtitle.

    So I dug into the subtitle subsystem. I discovered that the subtitle library operates by creating a linked list of subtitle bitmaps that the client app must render. The bitmaps are comprised of 8-bit alpha transparency values that must be composited onto the target frame (i.e., 0 = transparent, 255 = 100% opaque). For example, the letter ‘H’ :

                                      (with 00s removed)
    13 F8 41 00 00 00 00 68 E4  |  13 F8 41             68 E4    
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    14 FF DC D0 D0 D0 D0 E4 EC  |  14 FF DC D0 D0 D0 D0 E4 EC
    14 FF 7E 50 50 50 50 9A EC  |  14 FF 7E 50 50 50 50 9A EC
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    14 FF 44 00 00 00 00 6C EC  |  14 FF 44             6C EC
    11 E0 3B 00 00 00 00 5E CE  |  11 E0 3B             5E CE
    

    To get around the color explosion problem, I chose a threshold value and quantized values above and below to 255 and 0, respectively. Further, the process chooses an appropriate color from the existing palette rather than introducing any new colors.

    Muxing Matters
    In order to force VMD into a general purpose media framework, a lot of special information needs to be passed around. Like many paletted codecs, the palette needs to be transmitted from the file demuxer to the video decoder via some side channel. For re-encoding, this also implies that the palette needs to make the trip from the video encoder to the file muxer. As if this wasn’t enough, individual VMD frames have even more data that needs to be ferried between the muxer and codec levels, including frame change boundaries. FFmpeg provides methods to do these things, but I could not always rely on the systems to relay the data in all cases. I was probably doing something wrong ; I accept that. Instead, I just packed all the information at the front of an encoded frame and split it apart in the muxer.

    I could not quite figure out how to get the audio and video muxed correctly. As a result, neither FFmpeg nor the Phantasmagoria engine could replay the files correctly.

    Plan B
    Since I was having so much trouble creating an entirely new VMD file, likely due to numerous unknown bits of the file format, I thought of another angle : re-use the existing VMD file. For this approach, I kept the video encoder and file muxer that I created in the initial phase, but modified the file muxer to emit a special intermediate file. Then, I created a Python tool to repackage the original VMD file using compressed video data in the intermediate file.

    For this phase, I also implemented a command line switch for FFmpeg to disable subtitle blending, to make the feature feel like less of an unofficial hack, as though this nonsense would ever have a chance of being incorporated upstream.

    At this point, I was seeing some success with the complete, albeit roundabout, subtitling process. I constructed a subtitle file using “Spanish I Learned From Mexican Telenovelas” and the frames turned out fairly readable :


    Le puso los cuernos a él

    “she cheated on him”


    es un desgraciado

    “he’s a scumbag” … these random subtitles could fit surprisingly well !


    The few files that I tested appeared to work fine. But then I handed off my work to The Translator and he immediately found a bunch of problems. According to my notes, the problems mostly took the form of flashing, solid color frames. Further, I found tiny, mostly imperceptible flaws in my RLE compressor, usually only detectable by running strict comparison tools ; but I wasn’t satisfied.

    At this point, I think I attempted to just encode the entire palette at the front of each frame, as allowed by the format, but that did not seem to fix any problems. My notes are not completely clear on this matter (likely because I was still trying to figure out the exact problem), but I think it had to do with FFmpeg inserting extra video frames in order to even out gaps in the video framerate.

    Sigh, Plan C
    At this point, I was getting tired of trying to force FFmpeg to do this. So I decided to minimize its involvement using lessons learned up to this point.

    The next pitch :

    1. Create a new C program that can open an existing VMD file and output an identical VMD file. I know this sounds easy, but the specific method of copying entails interpreting individual parts of the file and writing those individual parts to the new file. This is in preparation for…
    2. Import the VMD video decoder functions directly into the program to decode the individual video frames and re-encode them, replacing the video frames as the file is rewritten.
    3. Wire up the subtitle system. During the adventure to disable subtitle blending, I accidentally learned enough about interfacing to the subtitle library to just invoke it directly.
    4. Rewrite the RLE method so that it is 100% correct.

    Off to work I went. That part about lifting the existing VMD decoder functions out of their libavcodec nest turned out to not be that straightforward. As an alternative, I modified the decoder to dump the raw frames to an intermediate file. In doing so, I think I was able to avoid the issue of the duplicated frames that plagued the previous efforts.

    Also, remember how I was really pleased with the palette conversion technique in which I was able to leverage computer science big-O theory ? By this stage, I had no reason to convert the paletted video to RGB in the first place ; all of the decoding, subtitling and re-encoding operates in the paletted colorspace.

    This approach seemed to work pretty well. The final program is subtitle-vmd.c. The process is still a little weird. The modifications in my own FFmpeg fork are necessary to create an intermediate file that the new C tool can operate with.

    Next Steps
    The Translator has found some assorted bugs and corner cases that still need to be ironed out. Further, for extra credit, I need find the change windows for each frame to improve compression just a little more. I don’t think I will be trying for LZ compression, though.

    However, almost as soon as I had this whole system working, The Translator informed me that there is another, different movie format in play in the Phantasmagoria engine called ROBOT, with an extension of RBT. Fortunately, enough of the algorithms have been reverse engineered and re-implemented in ScummVM that I was able to sort out enough details for another subtitling project. That will be the subject of a future post.

    See Also :

    The post Subtitling Sierra VMD Files first appeared on Breaking Eggs And Making Omelettes.