We have an app that uses the ffmpeg C API to encode mpeg-4 (AV_CODEC_ID_MPEG4) files in a mp4 container. The problem is that the files don't play in Windows Media Player or the Windows 10 video player "Movies & TV" app. It plays in VLC, google chrome, Ubuntu's video player, and all other video players I've tried.
The two Windows players are able to play other files encoded with mpeg-4 in mp4 container. I also tested transcoding video files to the same format using the command line 'ffmpeg' tool and was successfully able to play the video using the following command:
ffmpeg input.avi -c:v mpeg4 output.mp4
While I found the following commands do not work:
ffmpeg input.avi -c:v mpeg4 -vtag xvid output.mp4
ffmpeg input.avi -c:v libxvid output.mp4
# the last command wont play with windows media player but VLC can still play it. If the extension of the output file is changed to avi for the last two commands then Windows media player can play it.
I started looking at the ffmpeg src code but it appears a bit large/complex, I tried using the simpler "encode_video.c" example, which was able to encode a video and play it in Ubuntu's default video player but VLC nor Windows Media Player could play it.
We need to encode these using the ffmpeg API, not the command line tool, so I am wondering what the ffmpeg command line tool is doing that I am not, or any ideas on what the problem could be and how to get this working.
Thanks.