I\'m trying to encode a H.264 video with the FFMPEG C API. I have successfully compiled and executed the decoding/encoding example provided by FFMPEG.
The problem I\'m f
Your problem probably is not encoding itself but the fact that you output raw H.264 stream (I suppose you used AnnexB format) without any muxing. Most of players expect H.264 in some container (like MKV, MP4 or FLV) and do not support playing of raw H.264 streams. For players using DirectShow filters (like MPC-HC / WMP) it also needs raw H.264 AnnexB demuxer before decoder. Try to mux this output to MKV with MKVToolnix and test resulting file.
As mentioned by nobody555, maybe your VLC simply cannot open that file because it is a raw stream.
Alternatives are listed at: https://superuser.com/questions/261774/converting-or-playing-a-264-video-file
ffplay
is an option, but it also works on VLC 2.2.1, Ubnuntu 15.10.
Also consider the example: https://github.com/FFmpeg/FFmpeg/blob/n3.0/doc/examples/muxing.c which generates a container format instead of a raw stream.