I've downloaded and built ffmpeg 3.2 with --enable-gpl --enable-libx264
and also built the examples.
I then ran the decoding_encoding program with h264
argument, which produced the file test.h264
.
I then could not play this file in Quicktime Player (version 10.4 on macOS 10.11.5 ). It plays fine in VLC.
I don't understand why it does not work. The ffmpeg documentation states that:
QuickTime only supports YUV planar color space with 4:2:0 chroma subsampling (use -vf format=yuv420p or -pix_fmt yuv420p) for H.264 video.
Looking at the file with ffprobe shows that it is in the yuv420p format:
Input #0, h264, from 'test.h264':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 352x288, 25 fps,
25 tbr, 1200k tbn, 50 tbc
Why is this file not playing in Quicktime. What adjustments would be necessary to the decoding_encoding so that it plays?
Thank you for your help
Quicktime does not support raw elementary streams. You must put the es in a container such as mp4.
ffmpeg -i test.h.264 -codec copy test.mp4
Regarding the question "What adjustments would be necessary to the decoding_encoding so that it plays?": I extended the decoding_encoding example from ffmpeg/doc/examples by a method
video_encode_with_container_example()
so that it writes an mp4 container file with an h264 video stream. Compile the code below with ffmpeg 3.2 and x264, then calldecoding_encoding mp4
. This will produce a filetest.mp4
that opens in Quicktime.