Wednesday, May 29, 2013

What Happens when a video is uploaded to DAM?

When a video is uploaded to CQ DAM, the same workflow (“DAM Update Asset”) that kicks in for PDFs (described here) also kicks in.

However, the following two worksteps are specific to video ingestion:

For these to work, ffmpeg needs to be downloaded and installed (CQ does NOT come packaged with it).  See here for instructions.

The workstep “FFmpeg thumnails” uses the built-in process “Create Video Thumbnails”.  It extracts video frames and uses them as thumbnails.  See below:

The ‘Arguments’ count:4,index:2,[140:100],[48:48],[319:319] means that 4 key frames will be extracted (count:4), the third extracted key frame (index:2, 0-based index) will be used to generate 3 thumbnails of dimensions140x100 pixels, 48x48 pixels, and 319x319 pixels.  More documentation on this available here.

The server.log will report all of this.  Example below:

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec (info): [C:\Programs\FFMPEG\bin\ffmpeg.exe -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7954583360797884766.tmp\IMG_0268.MOV]

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec (thumbs): [C:\Programs\FFMPEG\bin\ffmpeg.exe -ss 0.0 -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7954583360797884766.tmp\IMG_0268.MOV -vframes 1 -y C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7954583360797884766.tmp\tempthumb.1352590934080.0.jpg]

As you can see, there is disk I/O happening to the folder configured as the Java temp directory.  You can control this with the JVM init argument in CQ’s start.bat.  Example: -Djava.io.tmpdir=E:\CQ_5.5_temp

…..

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper created 4 thumbnails

The workstep “FFmpeg transcoding” uses the built-in process “Transcode Video” to create additional renditions of the original video.

The arguments profile:firefoxhq,profile:hq,profile:flv means that all the three video profiles defined in CQ will be used. firefoxhq will create a highquality .ogg rendition, hq will create a high quality H.264 (.m4v) rendition andflv will create a low quality (320x240 pixels) Flash Video rendition.  To see these video profiles, navigate to Tools->DAM->Video Profiles (/miscadmin#/etc/dam/video).  See below:

You can edit these video profiles to fit your needs.

I recently shot a 1:26 minute video using a Canon EOS 5D MK III.  Shot in 1920x1080 at 30 frames per second, the file size was 955,114,640 bytes and in the .MOV format.  The video details, as listed by MediaInfo is shown below:

Upon ingestion to CQ DAM, metadata got extracted, thumbnails got generated (140 pixels x 100 pixels, 319x319, and 48x48), and two additional video renditions were generated (OGG and FLV at 320 pixels x 240 pixels).

—————————

The OGG rendition was available at /jcr:content/renditions/cq5dam.video.firefoxhq.ogg

The server.log reported this:

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec: [C:\Programs\FFMPEG\bin\ffmpeg.exe -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7155082853427817219.tmp\IMG_0268.MOV -b 4096k -r 24000/1001 -bt 4069k -acodec libvorbis -ac 2 -ar 44100 -ab 128k -y C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7155082853427817219.tmp\IMG_0268.out.ogg]

—————————-

The FLV rendition was available at /jcr:content/renditions/cq5dam.video.flv.320.240.flv  The server.log reported this:

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.video.FFMpegTranscodeProcess processVideo: creating video using profile [flv]

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec (info): [C:\Programs\FFMPEG\bin\ffmpeg.exe -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7155082853427817219.tmp\IMG_0268.MOV]

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec: [C:\Programs\FFMPEG\bin\ffmpeg.exe -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7155082853427817219.tmp\IMG_0268.MOV -s 320x240 -b 200k -r 12 -acodec libmp3lame -ac 1 -ar 22050 -ab 56k -y C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam7155082853427817219.tmp\IMG_0268.out.flv]

——————-

The H.264 rendition failed with the following error messages:

*INFO* [Thread-85] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper FFMPEG Exec: Unrecognized option ‘directpred’

*INFO* [Thread-85] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper FFMPEG Exec: Failed to set value ‘3’ for option ‘directpred’

*ERROR* [JobHandler: /etc/workflow/instances/2012-11-10/model_788493259155:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.video.FFMpegTranscodeProcess Process exited with an error: 1(Exit value: 1) java.io.IOException: Process exited with an error: 1(Exit value: 1)

To fix this, remove the custom ffmpeg arguments for the H.264 video profile, and set the audio codec as alac, as described here.

———————

The M4V rendition will be available at /jcr:content/renditions/cq5dam.video.hq.m4v  The server.log will report this:

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_8772044570710:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.video.FFMpegTranscodeProcess processVideo: creating video using profile [hq]

*INFO* [JobHandler: /etc/workflow/instances/2012-11-10/model_8772044570710:/content/dam/s7/IMG_0268.MOV/jcr:content/renditions/original] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper **** Exec (pass1): [C:\Programs\FFMPEG\bin\ffmpeg.exe -i C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam3621509705265785387.tmp\IMG_0268.MOV -b 6144k -r 24000/1001 -bt 8192k -vcodec libx264 -acodec alac -ac 2 -ar 44100 -ab 128k -y -pass 1 C:\Programs\Adobe\CQ_5.5\author\java_io_tmpdir\cqdam3621509705265785387.tmp\IMG_0268.out.m4v]

If everything is successful, the following JCR structure will be created (3 thumbnails, 3 video renditions + original video).

The metadata JCR node contained multiple properties, representing the metadata extracted from the original video:

Source: http://cq-ops.tumblr.com/post/35446114362/what-happens-when-a-video-is-uploaded-to-cq-dam

No comments:

Post a Comment