Can't seek beyond downloaded data in some H.264 videos in Silverlight
The project I'm currently working on is using a Silverlight based player to stream wmv videos encoded through WME. However we want to be able to move away from Silverlight in the future and to the video tag in HTML5, so we need to encode our videos to H.264 in an mp4 container.
Everything is fine except for on small problem, it's not possible to seek beyond what has been downloaded, at least not on lower quality encodes. One of our test files is an HD wmv video, which we encode down to 2 Mbit, 1 Mbit and 0.5 Mbit using FFmpeg, and mp4box to reorder the moov atoms.
In both the 2 and 1 Mbit encodes the Silverlight MediaElement recognizes a seek beyond what's downloaded as we'd like it to, and requests video data and starts playing from the seek point.
However, with the 0.5 Mbit video that doesn't happen, and instead the video freezes while it keeps downloading the video normally.Using a low-quality H.264 video from Youtube works, so I don't know if it's the parameters to FFmpeg that's the problem or something else.
Here's the encoding command-line:
ffmpeg -y -i fooHD.wmv -an -vcodec libx264 -vpre slow -level 41 -b 2000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 1 -f rawvideo nul
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 2000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar2000k.mp4
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 1000k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar1000k.mp4
ffmpeg -y -i fooHD.wmv -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -vpre slow -level 41 -b 500k -bufsize 20000k -maxrate 25000k -g 250 -coder 1 -flags +开发者_如何学编程loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +dct8x8+bpyramid -me_method umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 -threads 0 -pass 2 bar500k.mp4
mp4box.exe -inter bar2000k.mp4
mp4box.exe -inter bar1000k.mp4
mp4box.exe -inter bar500k.mp4
fooHD.wmv is 2:17 long and running at 8 Mbit/s @ 29.97 fps.
My throught immediately goes to an issue related to a lack of keyframes, but I see -g 250 for all your encoding settings. However based on some past issues with encoders getting fast and loose with I-frame settings at low bandwidth I still suggest reading back the I-frame/keyframe stats to see if your 500k file is not being encoded the way you asked.
精彩评论