Skip to content

Media File Processing

Paul Gregoire edited this page Aug 12, 2016 · 2 revisions

#Media File Processing Pre-process and Post-processing is now easier starting with version 1.0.8-M7. The first version implemented is focused on post-processing when FLV files are written; in later revisions we'll implement more.

The first step to implement a writer post-processor, is to locate the flv.impl bean node in your conf/red5-common.xml file, it will resemble the snipit below

  <bean id="flv.impl" class="org.red5.io.flv.impl.FLV">
    <property name="cache">
      <ref bean="object.cache"/>
    </property>
  </bean>

Add an property node for your IPostProcessor implementation as the example shows below (using our included example implementation)

  <bean id="flv.impl" class="org.red5.io.flv.impl.FLV">
    <property name="cache">
      <ref bean="object.cache"/>
    </property>
    <property name="writerPostProcessor" value="org.red5.media.processor.GenericWriterPostProcessor" />
  </bean>

The example class provided simply counts the tags in the file and prints the results to the log, here's example output

2016-08-11 15:23:23,603 [pool-9-thread-1] INFO  o.r.m.p.GenericWriterPostProcessor - Data type counts - audio: 342 video: 174 metadata: 1

The ability to specify multiple processors is also available and each processor is executed in the order specified. Note the property name difference when specifying mulitple processors: single - writerPostProcessor vs multiple - writerPostProcessors.

  <bean id="flv.impl" class="org.red5.io.flv.impl.FLV">
    <property name="cache">
      <ref bean="object.cache"/>
    </property>
    <property name="writerPostProcessors">
      <set>
        <value>org.red5.media.processor.GenericWriterPostProcessor</value>
        <value>org.red5.media.processor.SomeOtherNonExamplePostProcessor</value>
      </set>
    </property>
  </bean>
Clone this wiki locally