ffmpeg split video H264 stutters on Windows Media Player

Questions involving a Windows version of FFmpeg.
Post Reply
jfoegen
Posts: 2
Joined: Sat Mar 09, 2019 3:31 am

ffmpeg split video H264 stutters on Windows Media Player

Post by jfoegen » Sat Mar 09, 2019 3:48 am

I am converting and splitting wmv and mp4 into new mp4 files. I am using ffmpeg to do the conversion with simply:

Code: Select all

ffmpeg -i inputfile.wmv -vcodec libx264 -ss 00:00:10 -t 00:00:15 outputfile.mp4
So when I create my split video it plays fine on other video players, like VLC, but stutters when initially playing on Windows Media Player and even shows a blank screen for a moment and then after about 5 seconds, the video will play normally. If I then select play again without reloading, Windows Media Player will play the video fine, with no stuttering.

If I REMOVE the start parameter when doing the conversion, then the resulting video will play without issues on all my players, INCLUDING Windows Media Player.

I have tried changing the frame rate, the bit rate and altered different optimization options mentioned here - https://trac.ffmpeg.org/wiki/Encode/H.264

I need the split video to play on Windows machines on Windows Media Player and on the web streamed using the video element. This is why I chose H264 codec and MP4.

Has anyone had issues playing ffmpeg split videos using H264 codec with Windows Media Player? I am using the latest version of ffmpeg. Anyone have any other suggestions on any different settings I could try to adjust?
Thanks

pandy
Posts: 215
Joined: Mon Feb 24, 2014 1:46 pm

Re: ffmpeg split video H264 stutters on Windows Media Player

Post by pandy » Mon Mar 25, 2019 11:17 am

You should cut video on IDR (assuming H.264) frames, use closed GOP, also adding "-movflags faststart" (mp4 container flag) may improve observed behaviour.

jfoegen
Posts: 2
Joined: Sat Mar 09, 2019 3:31 am

Re: ffmpeg split video H264 stutters on Windows Media Player

Post by jfoegen » Mon Mar 25, 2019 1:40 pm

It seems setting the Keyframe distance or GOP lower helps a lot when splitting. Adding a force of key frames did not do anything (-force_key_frames 00:00:00.100100 to place it right after the start), but setting the keyframe interval (GOP length) -g to 50 and -keyint_min to 20 seems to have solved the issue with Windows Media Player.

This may be what you are suggesting with closed GOP. I had already added the faststart option. Thanks for the suggestion

pandy
Posts: 215
Joined: Mon Feb 24, 2014 1:46 pm

Re: ffmpeg split video H264 stutters on Windows Media Player

Post by pandy » Mon Mar 25, 2019 3:52 pm

you may try to add 'stitchable=1' flag to x264 private properties - i always encode h.264 with closed gop's and flag stitchable

Code: Select all

@SET x264opts="crf=18:level=4.0:qpmin=16:vbv_maxrate=9984:vbv_bufsize=9984:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709:stitchable=1"

@ffmpeg.exe -hide_banner -v quiet -stats -y -i %name% -sn -dn -c:v libx264 -preset faster -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -flags:a +qscale -c:a libmp3lame -q:a 4 -f matroska "%~n1_.mkv"

Post Reply
'