[ALF-19056] Can't load Alfresco with FFmpeg and video transformations Created: 11-Jun-13  Updated: 17-Jul-13  Resolved: 13-Jun-13

Status: Closed
Project: Alfresco
Component/s: Transformations
Affects Version/s: 4.2.d Community
Fix Version/s: 4.2 Enterprise
Security Level: external (External user)

Type: Bug Priority: Blocker
Reporter: David González (Inactive) Assignee: Closed Issues
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Debian 7.0 x86_64 / Tomcat 7.0.30 / MySQL 5.6

Attachments: File video-thumbnail-context.xml.sample     File video-thumbnail-context.xml.sample.old     File video-transformation-context.xml.sample     File video-transformation-context.xml.sample.old    
Issue Links:
is duplicated by ALF-18570 Startup fails with ffmpeg installed a... Closed
is duplicated by ALF-19057 FFmpeg sample transformation config b... Closed
Date of First Response:


I installed FFmpeg and tried to use video transformations but Alfresco doesn't start. The steps followed where the next:

1. Stopped Alfresco.

2. Installed FFmpeg from Debian Multimedia repository.

3. Checked it was correctly installed with: ffmpeg -v. Partial result of this command is:

ffmpeg version 0.7.15, Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 22 2013 07:18:58 with gcc 4.4.5

4. Found its location with whereis ffmpeg:

ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

5. Set the path to ffmpeg in alfresco-global.properties:


6. Renamed the files video-thumbnail-context.xml.sample and video-transformation-context.xml.sample to video-thumbnail-context.xml and video-transformation-context.xml.

7. Moved these files to: $TOMCAT_HOME/shared/classes/alfresco/extension.

8. Started Alfresco.

After that, the next error is logged:

2013-06-11 09:16:28,271 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformer.worker.ffmpeg.flv' defined in file [/usr/alfresco/tomcat/shared/classes/alfresco/extension/video-transformation-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'explicitTransformations' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'explicitTransformations' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
... 28 more

And it can't be started.

Comment by Will Abson [X] (Inactive) [ 11-Jun-13 ]

Dupe of ALF-18570

Comment by Will Abson [X] (Inactive) [ 12-Jun-13 ]

From the investigations done around ALF-18570 which this bug duplicates

The issue occurrs because of the order of property injection in the beans defined in the video-transformation-context.xml and video-thumbnail-context.xml.
The explicitTransformations property now requires mimitypeService to be injected earlier (as it is used in org.alfresco.repo.content.transform.ContentTransformerHelper.getExtensionOrAny(String)).

After changing the order of injected properties the issue is not reproduced.

The explicitTransformations property is actually no longer used as per ALF-19057, but moving mimetypeService up to be the first property defined for the beans in that file (i.e. so it is defined before explicitTransformations) fixes this issue.

This change was committed but has not yet been merged to the HEAD codeline.

Comment by Alan Davis [ 13-Jun-13 ]

The reason for the NPE (ALF-19056) is that the explicitTransformations were defined on the worker rather than the transformer bean. Transformation settings were normally only defined on the transformer bean, which did not result in a NPE. The NPE no longer takes place if defined on the worker bean and the following log message is issued if video-thumbnail-context.xml.sample.old is used (part of the problem described in ALF-19057).

...ContentTransformerHelpe] In order to support dynamic setting of transformer options, Spring XML configuration
...ContentTransformerHelpe] is no longer used to initialise these options.
...ContentTransformerHelpe] Your system appears to contains custom Spring configuration which should be replace by
...ContentTransformerHelpe] the following Alfresco global properties. In the case of the Enterprise edition these
...ContentTransformerHelpe] values may then be dynamically changed via JMX.
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.flv.jpg.priority=50
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.flv.jpg.supported=true
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.mpg.jpg.priority=50
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.mpg.jpg.supported=true
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.mp4.jpg.priority=50
...ContentTransformerHelpe] content.transformer.ffmpeg.thumbnail.extensions.mp4.jpg.supported=true
... 20 more lines

In 4.2d transformer settings are defined in alfresco global properties rather than Spring. Typically only one property is needed rather than about 8 lines of XML. In the Enterprise edition these properties may be changed via JMX while Alfresco is running.

Attached are the new and old versions of the sample files for comparison. You will see at the top of the new files a section that specifies the properties that should be set. These identify the supported transformation (the other part of the problem described in ALF-19057). As can be seen these properties have been simplified as only one priority property needs to be set per transformer. The generated properties above has one per mimetype combination.


The concept of 'explicit' transformations does not really exist in 4.2d, but has been replaced by 'priority' (which is new) and 'supported' mimetype transformations. As the default priority is 100, setting the priority to 50 normally results in the transformer being used. The difference is that prior to 4.2d, other transformers would not be tried if all 'explicit' transformers failed for some reason.

Comment by Alan Davis [ 13-Jun-13 ]

Using JConsole [MBeans]/Alfresco/ContentTransformer/Config/Operations/getTransformationsByTransformer(String, String) part of the returned output shows the possible transformations for the new transformers (does not include transformer.complex.ffmpeg.Image as there are just too many options). Note the limited number of transformations and the priority.

43          ffmpeg.flv<<Runtime>> 0 ms
43              1) 3g2  flv   [50] unlimited
43              2) 3gp  flv   [50] unlimited
43              3) asf  flv   [50] unlimited
43              4) avi  flv   [50] unlimited
43              5) avx  flv   [50] unlimited
43              6) mov  flv   [50] unlimited
43              7) movie flv   [50] unlimited
43              8) mp4  flv   [50] unlimited
43              9) mpeg2 flv   [50] unlimited
43             10) mpg  flv   [50] unlimited
43             11) ogv  flv   [50] unlimited
43             12) wmv  flv   [50] unlimited
44          ffmpeg.mp3<<Runtime>> 0 ms
44              1) aiff mp3   [50] unlimited
44              2) au   mp3   [50] unlimited
44              3) m4a  mp3   [50] unlimited
44              4) oga  mp3   [50] unlimited
44              5) wav  mp3   [50] unlimited
45          ffmpeg.mp4<<Runtime>> 0 ms
45              1) 3g2  mp4   [50] unlimited
45              2) 3gp  mp4   [50] unlimited
45              3) asf  mp4   [50] unlimited
45              4) avx  mp4   [50] unlimited
45              5) mov  mp4   [50] unlimited
45              6) movie mp4   [50] unlimited
45              7) mpeg2 mp4   [50] unlimited
45              8) mpg  mp4   [50] unlimited
45              9) wmv  mp4   [50] unlimited
46          ffmpeg.thumbnail<<Runtime>> 0 ms
46              1) 3g2  jpg   [50] unlimited
46              2) 3gp  jpg   [50] unlimited
46              3) asf  jpg   [50] unlimited
46              4) avi  jpg   [50] unlimited
46              5) avx  jpg   [50] unlimited
46              6) flv  jpg   [50] unlimited
46              7) mov  jpg   [50] unlimited
46              8) movie jpg   [50] unlimited
46              9) mp4  jpg   [50] unlimited
46             10) mpeg2 jpg   [50] unlimited
46             11) mpg  jpg   [50] unlimited
46             12) ogv  jpg   [50] unlimited
46             13) wmv  jpg   [50] unlimited
Comment by Alfresco QA Team (Inactive) [ 17-Jul-13 ]

Validated on Alfresco Enterprise v4.2.0(r52561-b165), RHEL 6.3x64, Tomcat 7.0.35, MySQL 5.5 +ffmpeg 2.0.
No NPE in the log. After setting the properties described in video-thumbnail-context.xml and video-transformation-context.xml transformations take place.


Generated at Sun Jan 24 16:39:36 GMT 2021 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.