Converted MP4 files play with no audio in QuickTime/iTunes
When I use the "!Convert/Stream..." dialog to convert a file to mp4 or m4v, the resulting file can be played back correctly in VLC, but if I attempt to play it in Quicktime Player or iTunes, it does not recognize the audio track. It plays back with no audio, and in the file info it does not list an audio track.
This happens even when I am just copying the video and audio streams and not transcoding, even with files that started out as mp4.
This is happening for me in VLC 2.1.5 on OS X 10.9.4.
I originally thought this was a problem with stream order swapping and reported it under a different bug ([ticket:12062]), but after looking more closely I think it's an issue with the metadata inside the converted MP4 file.
Reproduction
To reproduce on OS X:
- Download the "sample_mpeg4.mp4" file from Apple's "Quicktime sample movie files" at http://support.apple.com/kb/HT1425
- Select "File > Convert / Stream..." in VLC and open the downloaded file.
- Select a Custom profile that copies the streams and saves to "MP4/MOV" a. Select "Custom" from the dropdown under Choose Profile b. Click the "Customize..." button c. Under Encapsulation, select "MP4/MOV" d. Under Video codec, check Video and check "Keep original video track" e. Under Audo codec, check Audio and check "Keep original audio track" f. Optionally, save this new profile as "MP4 - no transcode" g. Click Apply
- Click "Save as File" under Choose Destination, click Browse, type in the file name "sample_mpeg4-vlc.m4v", and click Save in the file selection dialog
- Click Save back on the Convert & Stream dialog
- Open the new sample_mpeg4-vlc.m4v file in VLC and play it. a. For me, it plays, including sound
- Run Quicktime Player, choose File > "Open File..." and select the newly converted file.
- Click the Play icon. a. For me, it will play the video, but no sound will be output.
- Press Cmd-I or select Window > Show Movie Inspector from the Quicktime Player menu to reveal the movie inspector a. For me, the inspector will show a single line in the format field saying "MPEG-4, 190 x 240". b. In contrast, if you open the original "sample_mpeg4.mp4" file in Quicktime Player and view the movie inspector, it will have two lines under format: "MPEG-4, 190 x 240" and "AAC, 32000 Hz, Stereo (L R)", indicating that it recognizes the audio stream.
I'm attempting to attach the file I got as the output of this conversion.
Observations
Here's what ffprobe from ffmpeg 2.3.3 tells me about these two files, and another MP4 one converted using ffmpeg.
$ ffprobe -hide_banner sample_mpeg4-vlc.m4v
Input [#0](https://code.videolan.org/videolan/vlc/-/issues/0), mov,mp4,m4a,3gp,3g2,mj2, from 'sample_mpeg4-vlc.m4v':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1qt
creation_time : 2014-09-01 17:10:32
encoder : vlc 2.1.5 stream output
encoder-eng : vlc 2.1.5 stream output
Duration: 00:00:04.87, start: 0.000000, bitrate: 403 kb/s
Stream [#0](https://code.videolan.org/videolan/vlc/-/issues/0):0(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, stereo, fltp, 48 kb/s (default)
Metadata:
creation_time : 2014-09-01 17:10:32
handler_name : SoundHandler
Stream [#0](https://code.videolan.org/videolan/vlc/-/issues/0):1(eng): Video: mpeg4 (Advanced Simple Profile) (mp4v / 0x7634706D), yuv420p, 190x240 [SAR 1:1 DAR 19:24], 344 kb/s, 30 fps, 30 tbr, 1000k tbn, 1k tbc (default)
Metadata:
creation_time : 2014-09-01 17:10:32
handler_name : VideoHandler
The "brand" metadata in the files differs between the three of them.
Original Apple file:
$ ffprobe apple_qt_samples/sample_mpeg4.mp4 2>&1 | grep brand
major_brand : mp42
compatible_brands: mp42mp41
VLC converted M4V file:
$ ffprobe sample_mpeg4-vlc.m4v 2>&1 | grep brand
major_brand : isom
compatible_brands: mp41avc1qt
FFMPEG converted mp4 file:
$ ffprobe sample_mpeg4-ffmpeg.mp4 2>&1 | grep brand
major_brand : isom
compatible_brands: isomiso2mp41
}}}
I think that the presence of the 'qt ' brand in the compatible_brands list in the VLC-produced file is causing an incompatibility with Quicktime Player. If I open the file in a hex editor and replace the 'qt ' with 'isom' or 'mp42' or the invalid 'zzzz', all these variants will work in Quicktime Player, with audio.
This may have something to do with the difference between the Quicktime File Format (or "MOV" files) and MP4. They're very similar, but not exactly the same specifications. In particular, the QT file format expects an "hdlr" atom under the "minf" atom for sound and video information, in addition to one under the "mdia" atom. MP4 seems to only expect it under "mdia", and the converted .m4v files produced by VLC do not include this atom. (I viewed them in Atom Inspector to see their structure.)
I'd suggest that maybe 'qt ' should be removed from the compatible_brands list for MP4/M4V files produced by VLC.
And maybe a separate option to export Quicktime File Format MOV files should be provided. It seems like this was present in the VLC 1.x series, but the two formats got combined in to a single option in the new 2.x Convert screen. It seems incorrect to combine them in a single "MP4/MOV" option since they're two different file types, even if they're very similar and have a lot of overlapping support.
## Workarounds
1. Open the exported .m4v file in a hex editor and replace 'qt ' with 'isom'.
2. Rename the exported .m4v file to .mov
a. For me, this gets the audio to play in Quicktime Player again. But I don't think it's a great workaround, because I'm not sure it's a fully valid QTFF file, even if QT Player handles it.
## References
Quicktime File Format specification:
https://developer.apple.com/library/mac/documentation/Quicktime/QTFF/QTFFPreface/qtffPreface.html
Quicktime sample files:
http://support.apple.com/kb/HT1425
Atom Inspector can be found under Quicktime-related downloads:
https://developer.apple.com/downloads/index.action?q=Quicktime