Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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';