<commit_before># Media

An `ffmpeg` or `avconv` wrapper

## Installation

Install ffmpeg:

    brew install ffmpeg --with-tools --with-libvpx --with-libvorbis --with-libtheora

Add this line to your application's Gemfile:

    gem 'media'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install media

## Usage

Convert:

    conversion = Media.convert do
      options y: true
  
      # this example is slow, due to heavy network usage
      input 'http://www.google.com/images/srpr/logo3w.png' do
        options loop: 1, f: 'image2'
      end
  
      output '/path/to/example.webm' do
        options vcodec: 'libvpx', acodec: 'libvorbis', t: 4
        maps label('video'), label('audio')
        graph do
          chain do
            filter 'negate'
            filter 'hflip' do |f| # optional
              f.outputs 'video'
            end
          end
          chain do
            filter 'aevalsrc' do
              arguments 'sin(440*2*PI*t)' => true
              outputs 'audio'
            end
          end
        end
      end
    end

    conversion.call {|progress| p progress}<commit_msg>Use expressions syntax<commit_after># Media

An `ffmpeg` or `avconv` wrapper

## Installation

Install ffmpeg:

    brew install ffmpeg --with-tools --with-libvpx --with-libvorbis --with-libtheora

Add this line to your application's Gemfile:

    gem 'media'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install media

## Usage

Convert:

    conversion = Media.convert do
      options y: true
  
      # this example is slow, due to heavy network usage
      input 'http://www.google.com/images/srpr/logo3w.png' do
        options loop: 1, f: 'image2'
      end
  
      output '/path/to/example.webm' do
        options vcodec: 'libvpx', acodec: 'libvorbis', t: 4
        maps label('video'), label('audio')
        graph do
          chain do
            filter 'negate'
            filter 'hflip' do |f| # optional
              f.outputs 'video'
            end
          end
          chain do
            filter 'aevalsrc' do
              expressions 'sin(440*2*PI*t)'
              outputs 'audio'
            end
          end
        end
      end
    end

    conversion.call {|progress| p progress}
{'fraction_non_alphanumeric': 0.09310496267018006, 'fraction_numerical': 0.007026789635485288, 'mean_word_length': 1.7679222357229647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '998898', 'n_tokens_mistral': 705, 'n_tokens_neox': 682, 'n_words': 222}