Today news broke that you can access your Windows Phone 7’s storage folders from this webpage, most sites referred to this as Portable USB drive access. They also wondered about the usefulness of this USB drive method since even if you COULD copy say… a DOC file into a folder, you couldn’t access it in the Office app on the phone. For that you could use my webserver method.
But I recognized what the folders were (Me and the other 10 people who used a Powered By Windows Media PMP device :P) The folders you see when you browse to the device…
These are the MEDIA FOLDERS, From my experience Windows Media powered PMP would have folders like this and used this structure to hold it’s contents.
So it’s a simple way to move media around, big deal you say. But here’s the thing that interested me the most.
I CAN NOW DIRECTLY COPY VIDEO FILES INTO THE DEVICE.
Remember that you can already copy video files to the device using the Zune application, but unless your file satisfied certain parameters the Zune application will reencode the file to the WMV format before copying it to the device.
But… when you attempt to copy a file into the video folder directly through Explorer you get this dialog instead.
So you can choose to drop the file onto the phone WITHOUT ANY REENCODING!
Now that I could copy video files into the phone directly what’s left was to find out what kind of codecs were supported. Microsoft provides a nice little list here. But I’d be lying if I’d say I knew what’s the difference between the various different profiles of MPEG4. ;) Anyway what’s missing on the list is.. AVI file container support.
Quick primer for those of you who are unfamiliar with how video files work. A video file consists of a container which has multiple streams and each stream might contain data using various codecs. A typical AVI file you download off the Internet would be using the AVI container format, and has 2 streams, a video stream using the MPEG4 codec (or more commonly known as XVID), and an audio stream using the MP3 codec.
The problem here is that because Windows Phone 7 doesn’t support reading of AVI containers, it means that we are unable to just drop AVI files onto the phone. Based on my experience and testing when making my Simple Webserver, I know that MP4 Containers ARE supported and usable.
So now we have a problem, we have a container (AVI) which can’t be read by Windows Phone 7 but it contains streams MPEG4 and MP3 which CAN be used by Windows Phone 7. So the question was, how do we get the streams into a MP4 container WITHOUT having to go through any reencoding?
Enter the swiss army knife of video tools : FFMPEG
With FFMPEG it’s easy to copy streams from one container to another, with a simple command line of
ffmpeg –I inputfile.avi –vcodec copy –acodec copy output.mp4
The streams from inputfile.avi will be copied over to output.mp4 WITHOUT wasting time reencoding. Once processed you can then drop the MP4 file onto your phone and hopefully it’ll play properly (Remember, there are various other settings for MPEG4, and the phone doesn’t support all of them)
What’s that you say? You don’t know how to use the command line? How about this then?
It’s a VERY simple frontend to FFMPEG, you click on Pick Source to pick your source file. A quick analysis is done, and the program will tell you the state of the file. The destination file is entered automatically if possible, if not click Pick Destination for the output filename. (Be sure to enter a filename with the MP4 extension) Then click GO to start processing. Once it’s done copy the file over to your phone and try it out.
You can grab the M2RecontainInMP4 Program here. (I packaged the FFMPEG executable with it… I’m pretty sure I violated something in the licensing by doing so)
Things to note :-
- It’s not a PERFECT process, sometimes some artifacts will appear
- Renaming and deleting video files in Explorer seems to have WEIRD results, I think it’d be best if you don’t rename files on the device through Explorer. And to delete files, tap and hold on them in the Music & Videos app on your phone.
- I haven’t gotten a H.264 video codec file to play properly, so.. good luck with the files you have.
- This is a VERY VERY EASY hole for Microsoft to patch up. Let’s hope they don’t!