share-extras / media-viewers

Enhanced document previews for a range of different document and media types, plus a dashlet allowing any content item to be displayed on a site dashboard.
Apache License 2.0
29 stars 23 forks source link

Video previews (h264preview, flvpreview) generation #28

Open kamenf opened 10 years ago

kamenf commented 10 years ago

Generated previews do not use ffmpeg options from thumbnail definition (org_sharextras_video-transform-context.xml) but from transform definition (org_sharextras_video-thumbnail-context.xml). This prevents generated previews to have lower resolution then original video file.

This is observed in clear install of both Community 4.2.d and 4.2.e

wabson commented 10 years ago

I think you meant that the FFmpeg options from org_sharextras_video-transform-context.xml are used.

This is a known issue with RuntimeExec-based transformers and thumbnail defs in Alfresco, and AFAIK there is nothing that can be done in the Share Extras code to fix it.

The other issue with FFmpeg is that it is very hard to find a set of options which will work well across all platforms and for all users, so I have deliberately chosen a small set which at least works for everyone and does not generate huge files.

Since I expect you will want to change this I have tried to make it as easy as possible to override the transformer beans themselves, in your own alfresco/web-extension/*-context.xml file, e.g. to change the options used for the h264 previews

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans-2.0.dtd'>
<beans>
   <bean id="org_sharextras_media-viewers_ffmpeg.transform.mp4" parent="org_sharextras_media-viewers_ffmpeg.transform">
      <property name="defaultProperties">
          <map merge="true">
              <entry key="outfile_format" value="mp4" />
              <entry key="outfile_opts" value="-ar 44100 -ab 128k -vcodec libx264 -crf 25 -g 250 -r 25" />
          </map>
      </property>
   </bean>
</beans>

Although not as convenient as defining the transform options in a property file (I could not get this to work the last time I attempted it), at least this allows you to change the parameters via the outfile_opts value to something that you feel gives better results in your environment.

Is this a workable solution for you?

kamenf commented 10 years ago

Yes, it had to be reversed. Of course I meant FFmpeg options from org_sharextras_video-transform-context.xml.

Thank you for the explanation. It is clear and convenient how to change transform parameters.

What I am trying to figure out is is it possible to have transforms and previews to use different transformation parameters - for example transforms to keep original video resolution and better quality while previews to be with restricted resolution and probably lower quality.Is it possible this to be achieved by defining separate transforms for those two cases?