2

I have successfully created h264/mp4 movie files with ffmpeg and the x264 library.

Now I would like to change the h264 library from x264 to openH264. I could replace the x264 library with openH264, recompile ffmpeg and produce movie files, without changing my sources that produce the movie. The resulting movie opens fine in Quicktime on Mac, but on Windows, Windows Media Player 12 cannot play it.

The documentation about Windows Media Player support for h264 is unclear. File types supported by Windows Media Player states in the table that Windows Media Player 12 supports mp4, but the text below says:

Windows Media Player does not support the playback of the .mp4 file format.

From what I have observed, Windows Media Player 12 IS capable of playing h264/mp4 files, but only when created with x264.

Does anyone know how I need to adjust the configuration of the codec/context so that the movie plays in Windows Media Player? Does Windows Media Player only support certain h264 profiles?

I noticed the warning:

[libopenh264 @ 0x...] [OpenH264] this = 0x..., Warning:bEnableFrameSkip = 0,bitrate can't be controlled for RC_QUALITY_MODE,RC_BITRATE_MODE and RC_TIMESTAMP_MODE without enabling skip frame

With the configuration:

av_dict_set(&options, "allow_skip_frames", "1", 0);

I could get rid of this warning, but the movie still does not play. Are there other options that need to be set so that the movie plays in Windows Media Player?

Thank you for your help

ffprobe output of the file that does play fine in Windows Media Player:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_x264.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : retina
    encoder         : Lavf57.56.100
    comment         : Creation Date: 2017-03-10 07:47:39.601
  Duration: 00:00:04.17, start: 0.000000, bitrate: 17497 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661),
      yuv420p, 852x754, 17495 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler

ffprobe output of the file that does not play in Windows Media Player:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_openh264.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : retina
    encoder         : Lavf57.56.100
    comment         : Creation Date: 2017-03-10 07:49:27.024
  Duration: 00:00:04.17, start: 0.000000, bitrate: 17781 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661),
      yuv420p, 852x754, 17779 kb/s, 24 fps, 24 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      handler_name    : VideoHandler
Sacha Guyer
  • 151
  • 17
  • What does ffprobe say for the file, specifically pixel format? – Gyan Mar 09 '17 at 15:49
  • The pixel format is yuv420p for both. I have extended the question with the ffprobe output. – Sacha Guyer Mar 10 '17 at 07:00
  • Try this: `ffmpeg -i test_openh264.mp4 -c copy -vbsf h264_mp4toannexb test_openh264.ts` and then `ffmpeg -i test_openh264.ts -c copy test2_openh264.mp4` . Check both files in WMP. – Gyan Mar 10 '17 at 07:12
  • Ok, I just tried this, but test2_openh264.mp4 does also not play in WMP. – Sacha Guyer Mar 10 '17 at 07:22
  • I just tried encoding with OpenH264 and it works in WMP 12. Can you share your encode? – Gyan Mar 10 '17 at 07:53
  • @Mulvya, unfortunately I can not share my code. If it helps I could draft which ffmpeg calls I make. I based my code on [this code example](http://stackoverflow.com/a/41285859/2828311). When I try to open the produced file `test.mp4` in WMP I get an error message, while for the `test_openh264.mp4` file, no error is shown, but the file is not played either. Can you share the encoding code that you tried out? Did you use openh264 directly or within ffmpeg? – Sacha Guyer Mar 10 '17 at 08:08
  • I used the CLI: `ffmpeg -i infile -c:v libopenh264 out.mp4`. I'm using the binary I compiled using this script: https://github.com/jb-alvarado/media-autobuild_suite – Gyan Mar 10 '17 at 08:19
  • I just rechecked with the code from the comment above. The behaviour is the same: When run `decoding_encoding mp4` with ffmpeg and x264, the movie can be played in WMP, when run with ffmpeg and openh264, the movie cannot be played in WMP... – Sacha Guyer Mar 10 '17 at 08:44
  • Try at the command line, to verify it's your code rather than the encoder/muxer config. – Gyan Mar 10 '17 at 08:45
  • Ok, I built the ffmpeg executable with openh264 and then executed `ffmpeg -i test_x264.mp4 -c:v libopenh264 test_x264_converted.mp4`. The original file had `Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 352x288, 190 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) ` and the converted `Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 352x288, 307 kb/s, 25 fps, 25 tbr, 12800 tbn, 25600 tbc (default)` and could not be played in MVP. – Sacha Guyer Mar 10 '17 at 10:45
  • Try the binary from https://ffmpeg.zeranoe.com/builds/ and test on video on other machines. – Gyan Mar 10 '17 at 13:03
  • Ok, using these binaries on windows and converting with `ffmpeg -i test_x264.mp4 -c:v libopenh264 test_x264_zeranoe.mp4` produced a file that I could play with WMP. I did not find binaries for mac with libopenh264 support for testing if the same works when I convert on a mac. I'll now have to figure out what is wrong with my ffmpeg compilation... – Sacha Guyer Mar 10 '17 at 13:50
  • Hi @SachaGuyer I'm dealing with a similar issue - mp4 files libopenh264 encoded do not play in WMP Windows 7 (they play in Windows 10). Have you figured out how to configure ffmpeg without the need to post-process the file? – remus Oct 01 '18 at 12:17

0 Answers0