Search code examples
ffmpegstreamingh.264flowplayerpseudo-streaming

ffmpeg Encode video and audio for streaming with flowplayer


I'm using FFmpeg version 0.6 enabled with h264 libraries and having a hard time encoding video and audio to work with flowplayer.

I have tested flowplayer with videos that have already been encoded properly and it does indeed stream them.

so my question is how would I encode videos using ffmpeg for h264 pseudo streaming with flowplayer. I do have my streaming server set up and properly streaming the test videos.


Solution

  • this worked as a shell script

    #!/bin/bash
      infile="billboardReplaceFvS_jun29.mov"
      tmpfile="billboardReplaceFvS_jun29.mov_tmp.mp4"
      tmpfile2="billboardReplaceFvS_jun29.mov_tmp2.mp4"
      outfile="video.mp4"
      options="-vcodec libx264 -b 1200k -flags +loop+mv4 -cmp 256 \
           -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
           -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
           -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
               -g 150 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
           -qmax 51 -qdiff 4"
    
      ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile"
    
      ffmpeg -y -i "$tmpfile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile2"
    
      qt-faststart "$tmpfile2" "$outfile"