Last updated October 11, 2011. Created by WildKitten on October 11, 2011.
Log in to edit this page.
If you have installed video and ffmpeg_wrapper modules and want to calculate duration of your video CCK field in Computed field in the same content type, this is the code for it.
In computed code enter this:
if (!$node->nid) node_save($node);
$filepath = "";
module_load_include('inc', 'ffmpeg_wrapper', 'ffmpeg_wrapper_class');
$duration = ffmpeg_wrapper_get_file_duration($node->field_video_file[0]['filepath']);
$node_field[0]['value'] = $duration;where field_video_file is the name of CCK video file field (so change this to correspond to your CCK filed)
In display format eneter this:
$display = $node_field_item['value'] . ' sec';