@@ -162,21 +162,10 @@ struct mtmd_cli_context {
162162 return true ;
163163 }
164164
165- // Load multiple frames from a directory as a "video" (sequence of images)
165+ // Load multiple frames from a video file or a directory as a "video" (sequence of images)
166166 // Returns number of frames appended
167- size_t load_video_dir (const std::string & dir, int max_frames = 32 , int stride = 1 , bool recursive = false ) {
168- mtmd_video::LoadVideoOptions opts;
169- opts.max_frames = max_frames;
170- opts.stride = stride;
171- opts.recursive = recursive;
172- return mtmd_video::append_frames_from_dir (ctx_vision.get (), dir, bitmaps, opts);
173- }
174-
175- size_t load_video_path (const std::string & path, int max_frames = 32 , int stride = 1 ) {
176- mtmd_video::LoadVideoOptions opts;
177- opts.max_frames = max_frames;
178- opts.stride = stride;
179- return mtmd_video::append_frames_from_path (ctx_vision.get (), path, bitmaps, opts);
167+ size_t load_video (const std::string & path) {
168+ return mtmd_video::append_frames_from_path (ctx_vision.get (), path, bitmaps);
180169 }
181170};
182171
@@ -322,7 +311,7 @@ int main(int argc, char ** argv) {
322311 for (const auto & vpath : params.video ) {
323312 // for video understanding: disable UHD slicing (overview only)
324313 mtmd_set_minicpmv_max_slice_nums (ctx.ctx_vision .get (), 0 );
325- size_t n = ctx.load_video_path (vpath, /* max_frames */ 3 , /* stride */ 1 );
314+ size_t n = ctx.load_video (vpath);
326315 if (n == 0 ) {
327316 LOG_ERR (" Unable to load video frames from %s\n " , vpath.c_str ());
328317 return 1 ;
@@ -399,23 +388,19 @@ int main(int argc, char ** argv) {
399388 }
400389 std::string media_path = line.substr (7 );
401390 if (is_video) {
402- // parse optional args: "/video <dir> [max_frames] [stride] "
391+ // parse optional args: "/video <file/ dir path> "
403392 // simple split by spaces
404393 std::vector<std::string> parts = string_split (media_path, " " );
405- std::string dir = parts.size () > 0 ? parts[0 ] : media_path;
406- int max_frames = 32 ;
407- int stride = 1 ;
408- if (parts.size () > 1 ) max_frames = std::max (1 , atoi (parts[1 ].c_str ()));
409- if (parts.size () > 2 ) stride = std::max (1 , atoi (parts[2 ].c_str ()));
410- size_t n = ctx.load_video_path (dir, max_frames, stride);
394+ std::string path = parts.size () > 0 ? parts[0 ] : media_path;
395+ size_t n = ctx.load_video (path);
411396 if (n > 0 ) {
412- LOG (" %s video loaded with %zu frames\n " , dir .c_str (), n);
397+ LOG (" %s video loaded with %zu frames\n " , path .c_str (), n);
413398 // add one marker per frame to match mtmd_tokenize expectations
414399 for (size_t i = 0 ; i < n; ++i) {
415400 content += mtmd_default_marker ();
416401 }
417402 } else {
418- LOG_ERR (" ERR: failed to load video frames from %s\n " , dir .c_str ());
403+ LOG_ERR (" ERR: failed to load video frames from %s\n " , path .c_str ());
419404 }
420405 } else {
421406 if (ctx.load_media (media_path)) {
0 commit comments