Yesterday a colleague was struggling with a corrupt video file. It was a crucial recording in one of the TV-program we are currently making and he was therefore quite stressed. I took a look at the video file. It was a XDCAM HD422 wrapped in MXF with two seperate audio channels – the usual stuff when working woth C300. Mediainfo was able to read the metadata just fine. My favorite player MPC-HC was able to playback the file – with difficulties – whileas VLC just gave me a green output – I suspect VLC doesn’t play any XDCAM files.
When playbacking using MPC-HD, the framerate was very low and varied and it was just plain weird. The assistent editor had tried transcoding the corrupted file with Avid Media Composer and QuickTime pro – with no luck…
FFmpeg came to the rescue as it has done so many times before. Here is what I did:

The fast solution:

ffmpeg -r 25 -i input.MXF -vcodec copy -acodec copy output.mxf

Which just rebuilds the stream without transcoding. The trick is to tell FFmpeg that the input file is in fact 25 fps in spite of what the file tells it. That did the trick. The above rewrapping did however suffered from video and audio being out of sync, so I did the following:

ffmpeg -r 25 -i input.MXF -vcodec prores -profile:v 2 -map 0:a:0 -map 0:a:1 -map 0:v:0 -c:a pcm_s16le output.mov 

Here the audio is split in two separate mono streams in linear 16-bit (uncompressed, that’s the -c:a pcm_s16le part) – since the C300 can only record 16-bit. Also, the video part is transcoded into a nice 185 mbit/s ProRes – ´which worked great! – Ohh, the last version:

ffmpeg -r 25 -i input.MXF -vcodec prores -profile:v 2 -filter_complex “[0:1] [0:2] amerge” -c:a pcm_s16le output.mov

is a version, where the two audio streams gets merged into one combined stereo track if that’s what you prefer.

Hope that’s helps some other stressed out people out there 🙂