Find the answer to your Linux question:
Results 1 to 9 of 9
I have used a program in winblows called image grabber II which just takes a screen shot of an video file at random intervals and save them as one larger ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3

    linux image grabber


    I have used a program in winblows called image grabber II which just takes a screen shot of an video file at random intervals and save them as one larger jpg file. A sample file looks like this:



    Is there a linux program that can perform the same options as it seems trying to use this in CentOS 5 with wine does not function properly.

  2. #2
    Linux Newbie unchiujar's Avatar
    Join Date
    Oct 2006
    Posts
    194
    Try xvidcap.

  3. #3
    Linux Newbie
    Join Date
    Aug 2006
    Posts
    226
    QFrameCatcher is another option.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3
    Thanks for the responses. I could not get them to do what I wanted very well so I googled some and wrote up a script. Was able to use ffmpeg and montage to make something that works.



    It still needs a lot of work as I am not the best script person around, but so far it is working. If anyone wants the workings of it, I am more the willing to share it.

  6. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    2
    I'm looking for the same thing, hard2hold -- I'd love to see your script. Don't worry about not being the best scripter, I'll take it -- warts and all.

    > QFrameCatcher is another option.

    Yes! Thank you, this worked great!
    Last edited by funchords; 07-24-2007 at 06:59 PM. Reason: Added feedback on QFrameCatcher

  7. #6
    Just Joined!
    Join Date
    Jul 2007
    Posts
    3
    Warned u I am not a script guru:

    Code:
    #!/bin/bash
    RANGE=`tcprobe -i $1 2>&1 |grep "length:" | awk '{ print $2 }'`
    echo $RANGE
    #
    IMG1=`echo "$RANGE "*" 1/10" | bc`
    echo $IMG1
    IMG2=`echo "$RANGE "*" 2/10" | bc`
    echo $IMG2
    IMG3=`echo "$RANGE "*" 3/10" | bc`
    echo $IMG3
    IMG4=`echo "$RANGE "*" 4/10" | bc`
    echo $IMG4
    IMG5=`echo "$RANGE "*" 5/10" | bc`
    echo $IMG5
    IMG6=`echo "$RANGE "*" 6/10" | bc`
    echo $IMG6
    IMG7=`echo "$RANGE "*" 7/10" | bc`
    echo $IMG7
    IMG8=`echo "$RANGE "*" 8/10" | bc`
    echo $IMG8
    IMG9=`echo "$RANGE "*" 9/10" | bc`
    echo $IMG9
    ffmpeg -y -i $1 -f mjpeg -ss 100 -vframes 30 -an test0.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 200 -vframes 30 -an test1.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 300 -vframes 30 -an test2.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 400 -vframes 30 -an test3.jpg
    fImpeg -y -i $1 -f mjpeg -ss 500 -vframes 30 -an test4.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 600 -vframes 30 -an test5.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 700 -vframes 30 -an test6.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 800 -vframes 30 -an test7.jpg
    ffmpeg -y -i $1 -f mjpeg -ss 900 -vframes 30 -an test8.jpg
    montage -label $1 -comment $1 -geometry 480x260+10+10 -bordercolor black *.jpg $2
    rm test*
    Been in LA for this week so I have not had a chance to mess with this.

  8. #7
    Just Joined!
    Join Date
    Jul 2007
    Posts
    2

    Thank you!

    Thanks! I'll give that a try and let you know!

  9. #8
    Just Joined!
    Join Date
    Jan 2009
    Posts
    1
    sorry to dig this up again but I was wondering if anyone managed to get a similar script like this to work.

    I found a small php script that would generate a random thumb, but only a single thumbnail.

    PHP Code:
    <?php

    // where ffmpeg is located, such as /usr/sbin/ffmpeg
    $ffmpeg 'ffmpeg';

    // the input video file
    $video  dirname(__FILE__) . '/demo.mpg';

    // where you'll save the image
    $image  dirname(__FILE__) . '/demo.jpg';

    // default time to get the image
    $second 1;

    // get the duration and a random place within that
    $cmd "$ffmpeg -i $video 2>&1";
    if (
    preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        
    $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        
    $second rand(1, ($total 1));
    }

    // get the screenshot
    $cmd "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
    $return = `$cmd`;

    // done! 
    echo 'done!';

    ?>
    I have no idea about php coding but I tried to modify it by adding "montage" command at the end of the script which ended up looking like this.

    PHP Code:
    <?php

    // where ffmpeg is located, such as /usr/sbin/ffmpeg
    $ffmpeg 'ffmpeg';
    $montage 'montage';
    // the input video file
    $video  dirname(__FILE__) . '/demo.wmv';

    // where you'll save the image
    $image  dirname(__FILE__) . '/demo.jpg';
    $image2  dirname(__FILE__) . '/demo2.jpg';
    $image3  dirname(__FILE__) . '/demo3.jpg';
    // default time to get the image
    $second 1;

    // get the duration and a random place within that
    $cmd "$ffmpeg -i $video 2>&1";
    if (
    preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        
    $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        
    $second rand(1, ($total 1));
    }
    $cmd "$ffmpeg -i $video 2>&1";
    if (
    preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        
    $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        
    $second2 rand(1, ($total 1));
    }
    $cmd "$ffmpeg -i $video 2>&1";
    if (
    preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        
    $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        
    $second3 rand(1, ($total 1));
    }

    // get the screenshot
    $cmd "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
    $return = `$cmd`;
    $cmd "$ffmpeg -i $video -deinterlace -an -ss $second2 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image2 2>&1";
    $return = `$cmd`;
    $cmd "$ffmpeg -i $video -deinterlace -an -ss $second3 -t 00:01:01 -r 1 -y -vcodec mjpeg -f mjpeg $image3 2>&1";
    $return = `$cmd`;
    // done!
    echo 'done!';

    //montage the sets
    $cmd "montage -geometry 320x240+10+10 -bordercolor *.jpg screen.jpg";
    $return = `$cmd`;
    ?>

    I only added those two extra lines just to see if I can produce three thumbs and the montage actually worked but I know this isn't the most efficient way to do it and I would probably kill the server if I tried doing say 9 thumbnails.


    I would much rather a shell script that works or a far better example of what I was trying to achieve above.

    Please help!


  10. #9
    Just Joined!
    Join Date
    Jul 2009
    Posts
    1

    GFrameCatcher

    Also try GFrameCatcher.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •