Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Increase quailty of Video encode

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1111 Views
  • Howard
    Avatar
    Community Member
    215 Posts

    Increase quailty of Video encode Link to this post

    Hi UncleCheese,

    I've got video working perfectly along with ffmpeg but the quality of the video on the flv encode is a bit low for our use. Is there a way to up the bitrate of the transcode into flv, I saw variables for audio but not the video.

    Thanks,
    Howard

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Increase quailty of Video encode Link to this post

    I've had a go at implementing it, to FLV.php I added

    public static $video_bit_rate = 4000; // high for testing purposes

    then changed the createFLV function to

       private function createFLV()
       {
          $args = sprintf("-i %s -ar %d -ab %d -b %d -f flv %s",
             $this->absoluteRawVideoLink(),
             self::$audio_sampling_rate,
             self::$audio_bit_rate,
             self::$video_bit_rate,
             $this->absoluteFLVPath()
          );
          
          $output = self::ffmpeg($args);   
       }

    But this doesn't increase the quality or the generated filesize...

    Any ideas?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Increase quailty of Video encode Link to this post

    Thanks for looking into this. The FLV features of DOM are in a very nascent state and I right now my focus is just to get it working reliably on several different installs and hopefully make its way into some production sites. It seems to be doing well so far.

    I will definitely be adding a lot more features to it as I learn more about FFMPEG. There are hundreds of flags you can throw at the video conversion, including one for quality, that takes a value of 0 to 30. You might want to read the docs on that on the ffmpeg website. Hack the core code and see if it makes a difference for you and get back to me on what you find. If it looks good, I'll have you revert your changes and check it in to the svn channel.

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Increase quailty of Video encode Link to this post

    Hi again,

    Yea I couldn't see the single 0-30 quality setting in the ffmpeg documentation but I have achieved what I wanted by using -sameq which sets it to the same quality as the upload, I will tinker with it a bit more down the line. The changes I have made are the addition of the following to FLV.php I figured I would set it up so that I could pass any arguments I liked into the encode so that it would be easy to use the heaps of different encoding options.

       public static $extra_flv_commands;

       private function createFLV()
       {
          $args = sprintf("-i %s -ar %d -ab %d %s -f flv %s",
             $this->absoluteRawVideoLink(),
             self::$audio_sampling_rate,
             self::$audio_bit_rate,
             self::$extra_flv_commands,
             $this->absoluteFLVPath()
          );
          
          $output = self::ffmpeg($args);   
       }

       static function set_var($var, $value)
       {
          if(property_exists('FLV', $var))
             self::$$var = $value;
       }


    And then obviously in _config.php I included:

    FLV::set_var('extra_flv_commands','-sameq');

    What do you think about setting it up like this?

    (Also I've got a little bug but ill post it in the other thread)

  • house98
    Avatar
    Community Member
    31 Posts

    Re: Increase quailty of Video encode Link to this post

    Hey Howard.

    Thanks for this tip. Works great!

  • Rishi
    Avatar
    Community Member
    97 Posts

    Re: Increase quailty of Video encode Link to this post

    hello howardgrigg
    i am trying to make a video gallery,my ffmpeg is working fine and even its creating thumbnail and convertiing video into flv but nothing is showing up on the page..
    can you help me with your code where you have made video working fine,it willb e a great help.
    thank you in advance

    1111 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.