Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to encode a fully working h264 video for flash player?

I did some homework: It seems that I should use command like "ffmpeg -i input.mp4 -vcodec libx264 -g 1 -r 25 output.mp4" but no luck: the output.mp4 can not jump to other seekpoints(cuepoints) properly in any flash players. My search shows that the video may not have enough/correct keyframes encoded but '-g 1' should do the work. The input.mp4 is made by xvidcap directly.

Anyone knows the answer? Thanks!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Flash Media Encoding

Controls available in Flash Media Encoding Server are much more extensive than Adobe Media Encoder, but you start pretty much the same way: choosing your container format and preset enter image description here

Flash Media Server and Flash Player can both stream or play back any H.264 file in virtually any format, so either the F4V or MP4 container would work. If you want a file that can be played by both QuickTime Player and Flash Player, I would choose MP4; otherwise, use F4V. Choose a preset that uses a resolution equal to or higher than your target to ensure that you use the proper Profile and Level.

Figure 13 shows the H.264-related parameters in Flash Media Encoding Server. On the left are the default values for the preset selected in Figure below. On the right are the values I would use. Big red asterisks identify recommended changes from the preset values, none of which are very dramatic.

enter image description here

I would extend the GOP size to 300 and use adaptive B-frame placement to provide the encoder with maximum flexibility. Extending the number of reference frames from 2 to 4 potentially increases quality at a slight cost in encoding time and decoding complexity, while disabling fast inter and intra decisions again potentially increases quality, with some increase in encoding time.

Overall, my recommended values should produce optimum quality, though at the outer edge of encoding time. If throughput is critical, I would do the following:

Use the default value of 2 for reference frames

Enable all "fast" encoding options

Use a 16 × 16 Search shape

Use a Full pixel for Motion estimation subpixel mode

Enable two or four slices, assuming that you were encoding on a multiple-core system

If you take this route, however, you should compare the output from these parameters with the output using the recommended settings shown in Figure below to see if the faster encoding parameters make a noticeable quality difference.

On the audio front, I would use the default values and change only the target bitrate and channels to match my targets. I also use the default values for other H.264 encoding parameters, like Timestamps and Sequence End codes, that Flash Media Encoding Server makes available.

That's it! Go encode some video.

share|improve this answer

I used the following ffmpeg command to encode video:

ffmpeg.exe
-i big_buck_bunny_trailer-1080p.ogg
-c:v libx264 -profile:v baseline -preset slow -b:v 800k
-c:a libvo_aacenc -b:a 128k
-s 512x288 
-movflags faststart
big_buck_bunny_trailer-288p-faststart.mp4

The encoded videos seem to load properly in both Flash and HTML5 players. The command line is taken from this article.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.