immersive projection environments
Yesterday I wrote about the problem with obtaining mp4-formatted fulldome features, which is that to play them as mp4s I'd have to play them on my laptop with the fisheye projector set up as an extended desktop (a bit fiddly since the commands to start and so forth are visible on the dome -- although another planetarian says he uses fade to hide the commands in between features). Besides which, I keep my laptop with me rather than leaving it lying about at the planetarium, and there are volunteers who run some of the shows -- they prefer more straightforward procedures using the existing system, on which they were trained.
So all in all, it's much better for me to convert the mp4 video into the demuxed m2v (video file) -plus-ogg (audio file) pair with the java script to run them in the mediaglobe system, all in a neat folder with a title.txt in the toplevel directory at load-in time. That's what the MG2 software wants, so that's what I gave it. Only...
UPDATE: This is where the problem was. [ORIG: The audio (ogg file) was in tune and was sampled at the CD standard rate of 44.1 kHz, and it started out in sync with the video (m2v file), but rapidly "slid" as the video seemed to be playing faster than it was supposed to.] UPDATE: Well, supposedly it was sampled at 44.1 kHz, but in fact the original S/W I was using would take the sampling rate I wanted and ignore it in favor of the 48 kHz sampling rate of the original mp4. A sad commentary on friendly user interfaces... So, here's what I'm using on my Windows machine: MPEG_Streamclip. That will not demux an mp4 directly (nothing is ever easy, is it) and says so in the documentation, but it is sort of a GUI that ties together several programs, one of which is Prism Video File Converter. When you download MPEG_Streamclip, you get Prism (assuming you tell it to include everything). Prism will happily turn an mp4 into an MPG, no fuss. And while MPEG_Streamclip will not demux an mp4, it has no qualms about demuxing an mpg. However, it won't demux directly into an ogg file. It will produce the m2v and you should (probably; to be on the safe side) use the following to get the ogg:
In order to be absolutely certain that I am getting the audio sampling rate I specify, I open the original mp4 (which has very clear Properties that tell me this mp4 is 30 frames per second, audio sampled at 48 kHz) in MPEG_Streamclip and choose Export Audio... then I can set everything in the dialog that opens. I choose type: mp3, Channels: Stereo, "sample rate": 44.1 kHz, bit rate: 128 kbps. That's so I can be very specific about the bitrate in the final ogg file. I then use the other free download, "SWITCH" sound file converter to convert that mp3 to an .ogg file. It keeps the 44.1 kHz sampling rate, so at last (at last!) my audio and my video are staying in synchronization over the length of a 20-plus-minute show.
[ORIGINAL: The mp4 video track had been converted to an m2v with the STATED frame rate (from the MediaGlobe 2 manual) of 30 fps, but clearly that was not working. So I did a little research. Other possibilities were 29.7 fps and 23.9 (24) fps. After trying both of those, the solution was clear.] UPDATE: No, it wasn't. Fortunately, the frame rate stays at 30 fps without any prompting if I just use MPEG_Streamclip to demux the mpg I created using Prism. So once the solution actually *was* clear (the audio sampling rate was not what it was supposed to be), the sync drift problem was solved. Much happier now.
The m2v file has to be written with a frame rate of 24 fps. The ogg file is written with a sampling rate of 44.1kHz as stated in the manual [UPDATE: only if you make absolutely sure your software is paying attention to what you tell it!] but the video frames per second is NOT 30 (as stated, apparently incorrectly, in the manual). It's 24. After writing the m2v file with 24 fps, there is NO expanding slippage between video and audio, the way there was with 30 fps as the m2v frame rate. [UPDATE: Alas, that was only true for the short video I used as a test. Once I used the method on a longer video the evil slippage was back, plus at the lower fps rate the motion starts to look a little less fluid than it should be.
So, general advice for anyone else out there who is pulling out his or her hair over creating an m2v file that stays in sync with the ogg file: if they start out synced up and then the video begins to slip earlier than the audio, decrease your frames per second in the conversion. [UPDATE: This is actually still true] If they start out synced up and the video starts to seriously get later than the corresponding audio, increase your fps in the conversion.
UPDATE: Specific advice for anyone still using an MG2 system or needing m2v-plus-ogg for whatever arcane reason: MPEG_streamclip is a free download. Prism video converter comes with it and will make mp4s into mpgs so that even though MPEG_Streamclip won't demux an mpg you can still do that, in two steps. MPEG_streamclip *will* allow you to set the audio sampling rate when you just elect to Export Audio from the mp4 to, say, mp3 format, and once it's in that format and sampled at 44.1 kHz, the mp3 can be converted quickly and easily to an ogg file (preserving the sampling rate) using SWITCH (another free download). OK, this was certainly a learning process. I'm sure there will be more. If some bewildered person finds this useful, then I'm really glad I was able to cut your stressful period down by posting it. I also owe thanks to someone for pointing me toward MPEG_Streamclip and SWITCH rather than the straight FFMPEG and Avidemux I was trying to use. Those are both very powerful but evidently (from my lack of being able to get them to enforce sampling rates) are less noob-friendly; in particular Prism and MPEG_streamclip make use of one or both of these, but in a way that a Windows user has a chance of figuring out.
Today an older free show that was converted at 30 fps years ago and that the volunteers had refused to run because by the end it's embarrassingly out of sync has been re-converted and is in sync for the first time. I'm pretty happy about that. And all it took was a week of nerves and two days [UPDATE: Make that five days] of serious stress! :-)
Good luck, everyone. Happy New Year! And Clear Skies, or at least highly resolved skies. I'm hoping to see Comet 2014 Q2 Lovejoy one of these nights if the clouds will depart for a few hours! [Seen it. Fuzzy. Green. The "green" is kinda cool :-) ]