Can not save jpeg file

I wish to capture jpeg images from my webcam and keep them in webserver so that live video can be downloaded. Because my adsl connection can upload @ max. 256 kbps, I can only transmit 2/3 frames per second. But for testing purpose on local machine I am capturing 10 frams per second ( seting timer for 100 milliseconds)
My program starts capture but after 2/3 or 5/6 frames it simply exts without giving any errors. I have tried to debug. But can not find which exception is causing the program to exit. Pl. help me diagnosing the problem :
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.media.*;
import javax.media.control.*;
import javax.media.format.*;
import javax.media.util.*;
* Grabs a frame from a Webcam, overlays the current date and time, and saves the frame as a PNG to c:\webcam.png
* @author David
* @version 1.0, 16/01/2004
public class FrameGrab
static String filName;
static int no = 1;
static CaptureDeviceInfo deviceInfo;
static Player player;
static Image img;
static BufferedImage buffImg;
static FrameGrabbingControl frameGrabber;
static Buffer buf;
static Graphics2D g;
     public static void SaveFrame() {
onceAg:
System.out.println("Trying to grab frame !");
frameGrabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl");
buf = frameGrabber.grabFrame();
System.out.println("grabbed frame !");
// Convert frame to an buffered image so it can be processed and saved
try {
img = (new BufferToImage((VideoFormat)buf.getFormat()).createImage(buf));
} catch (Exception e) {
System.out.println("exception using BufferToImage " + e);
SaveFrame();
try {
buffImg = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
} catch (Exception e) {
System.out.println("exception creating new BuffImg " + e);
SaveFrame();
System.out.println("Buffer image created !");
try {
g = buffImg.createGraphics();
} catch ( NullPointerException e) {
System.out.println("exception creating graphics 2d " + e);
SaveFrame();
g.drawImage(img, null, null);
filName = Integer.toString(no) + ".jpg";
System.out.println("saving " + filName);
// Save image to disk as jpg
try {
ImageIO.write(buffImg, "jpg", new File(filName));
} catch ( IOException e ) {
System.out.println(" IOException " + e);
SaveFrame();
} catch ( Exception ex ) {
System.out.println(" Exception " + ex);
SaveFrame();
     no++;
public static void main(String[] args) throws Exception
// Create capture device
deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture:0");
player = Manager.createRealizedPlayer(deviceInfo.getLocator());
player.start();
// Wait a few seconds for camera to initialise (otherwise img==null)
Thread.sleep(2500);
final java.util.Timer timer = new java.util.Timer();
timer.scheduleAtFixedRate(new java.util.TimerTask() {
public void run() { SaveFrame();}}, 0, 100);
// Grab a frame from the capture device
// Stop using webcam
player.close();
player.deallocate();
System.exit(0);
Files are saved as 1.jpg, 2.jpg and so on. My another html page downloads these pictures @ every 100 milliseconds using javascript so that no seperate program is needed to show the video.
Pl. let me know how can I continue to save files .

Thank you so much catfoss.
I gave thread.sleep(60000) and was able to record more than 300 frames !. So, once again thanks a lot to pinpoint the error.
Now I am modifying the program and instead of using Thread.sleep I am going to use keyboard input ( Program will wait till Q is pressed. )
For thoe who are interested in viewing these pictures here is my javascript source, which show the live video :
<html>
<head>
<script type="text/javascript">
var no = 1;
var filn = "";
var myId;
function stopIt()
alert("stopping!");
clearInterval(myId);
alert("Interval Stopped!");
function startIt()
alert("Starting animation!");
myId = setInterval("changePic()",400);
//setTimeout(stopIt(),27000);
function changePic()
// alert("change time");
no++;
filn = no + ".jpg";
// alert(filn);
document.getElementById("b1").src =filn;
</script>
</head>
<body>
<img border="0" alt="Live video" src="1..jpg" id="b1"/>
<input type="button" name="startbut" value="Start Animation" onclick="startIt()">
<input type="button" name="stopbut" value="Stop Animation" onclick="stopIt()">
</body>
</html>

Similar Messages

  • Can not open JPEG files and can not create JPEG files from other software

    Can not open JPEG files and can not create JPEG files from other software (For example from Solidworks).
    When I try to right click on a JPEG, a notice window appears written: "Windows Explorer has stopped working - Windows is
    checking for a solution to the problem" and then the notice box disapears, the desktop appears and I can continue working.
    From the other side - If I try to save as JPEG a screen of Solidworks (like a view of a part) the Solidworks falls but the JPEG
    is created (I can see its name in the directory I created it).
    I can open the JPEGS with the Paint software if I want but not with the Windows Photo Viewer.
    I have the feeling that the Windows Photo Viewer disapeared from my computer - just a feeling.
    I will appreciate your assistance.
    Avi T. 2014

    Hi,
    Did Windows Photo Viewer option appear when you right click the JPEG file and select open with?
    I would like suggest you use Clean Boot to troubleshoot if there is third-party software conflict:
    How to perform a clean boot in Windows
    http://support.microsoft.com/kb/929135
    Karen Hu
    TechNet Community Support

  • I can not attach jpeg files to Email. I am running XP and use Yahoo mail

    I can not attach a picture / JPEG file to an email. I use yahoo email and have XP on the computer. I did not have this problem till I downloaded Firefox. Also since downloading firefox I can not get Internet explorer to connect to the internet.
    == This happened ==
    Every time Firefox opened
    == When I loaded Firefox

    Ernie
    thanks for the reply Here are the answers to your questions.
    yes each account has it's own drafts folder. and I can save the file into the drafts folder after follow the steps you outlined in your answer. I did repair permission but nothing has changed .
    one thing i discovered is that I can attach files to the mail if i reply to it. only when i create a new mail in one of those accounts can i not attach any files.
    Seeing on the side bar that you are a top user I have another question you might be able to answer
    my apple help is not working, when i go to finder and go to mac help the page is blank and if i search it just searches and nothing happens

  • I can not save ai files on to my external hard drive

    hi
    i have just brought a a new mac pro book
    i am trying to save ai file on my external hard drive which illustrator will not allow me!
    i have tried to save it on my desktop then tranfer on harddrive which it will not allow me!
    it allows me to open files from the hard drive but not save!!!
    please help!

    The device is formatted for Windows, as NTFS. The format is readable, but not natively writable on a Mac. To write to the device, you must either reformat it (erasing all the contents) or install third-party software to enable write access to NTFS.

  • Can not save .gif files & My Virus protection software found a virus in your program

    When ever I try to Save a .gif image, the upper bar populates with the image imformation, but the lower bar is completely empty, and offers no options. I am able to save all other types of images: .jpeg, .png, etc. Also, my virus protection software found a virus in your program files. Here is the result findings: Object: file Name: C:\Users\AppData\Local\Mozilla\Firefox\Profiles\9ifwxa87.default\Cache\2\B6\B7827d01 Threat: HTML/ScrInject.B.Gen virus Action: unable to clean Also, Firefox loads & runs really slow and sometimes fails to load at all. I have plenty of memory and hard disk space. Can you help me with these problems? I am expecially worried about the virus issue as I have a really good anti virus program & this is the 1st virus it has been unable to block or clean!

    Jim there have been other postings about the new Adobe applications being misidentified as possible viruses.  Please contact your virus protection company so they can update the definitions appropriately.

  • Can't save jpeg files to seagate hd with previous files from pc

    I am trying to save reworked raw and psd files as jpegs into a seagate hd and I'm getting an error message that reads
    no permission or authnorization to save. The hd was used on my pc and i need to use it between my pc at work and my mac at home.
    What can i do to use one hard drive with the two machines?

    See this tip.

  • In Premiere I can edit an avi or mov clip but I can not save the result as a like file.  Why not???

    In Premiere I can edit an avi or mov clip but I can not save tghe result as a like file.  What do I have to do???  It only saves a project.  Under 'File' the 'Export' function is greyed out.  I need help baddly.
    [email protected]
    Bill Schoon

    Boatbuilder
    Let us start from the beginning.
    It has been established that you have Premiere Elements 10. On what computer operating system is it running?
    There has not been a File Menu/Export/Movie export opportunitity in Premiere Elements since version 7. We are not up to version 12.
    For Premiere Elements 10, your export opportunities are all in Share/ including one for Computer. Under Computer there are several choices. The ones that you see are Adobe Flash Video, MPEG, and AVCHD. The others you have to scroll down to. And those choices are AVI, Windows Media, QuickTime, Image, and Audio. You do not have to use the scroll bar for this. You can click on Adobe Flash Video panel to get it to turn black. Then use the down arrow to go down the list and the up arrow to go up the list. Once you get to a category, you can select a preset and go with it or customize it under the Advanced Button/Video Tab and Audio Tab of the preset.
    If you post the properties of your source media that you want to try to match in the export, I would be glad to suggest the exact settings for you.
    We will be watching for your follow up with details.
    Thank you.
    ATR
    Add On...The Premiere Elements 10 File Menu is for more than Saving, just not exporting. One of the key features that can be access there is the Project Archiver. More on that another time.

  • "Can not Save file name " InDesign CS6 - Cloud---WTF!

    Hello anyone
    This new Cloud Adobe CS6 is SO buggy.
    not my first issue with it...
    I am using
    Cloud version of - but locally installed
    Trial version of CS6 InDesign.
    iMac - mountain lion 10.8.1
    i7/12Gig RAM. SSD, and 1 T platter drive.
    Anyway-
    After many HOURS of InDesign work.
    Many pages, lots of stuff.
    I exported my work as PDF to send to my boss. Worked fine.
    But I can't save the working file.
    All Save menu items are grayed out.
    The astericks is there in the window title.
    When I just close the file- I am prompted to Save the file or lose my work.
    I hit Save and get window
    "can not save filename"
    with no error code.
    NOTHING!
    This has happened twice. First time not a lot had been done to the file.
    So I just re-started the iMac
    This time I stand to lose some real work here.
    Does this happen if I just use the free version!?!?!?!?
    I will happily pay after my trial but if this is what the new CS6 has in store, then screw Adobe.
    Can anyone help me???

    There's no difference in fuctionality between paid and free versions.
    There are two things worth trying, if you haven't already closed and lost the file. The first is to export to .idml, open that and see if you can save it with a new name: Remove minor corruption by exporting
    The second is riskier as it depends on ID's amazing file recovery after a crash. If the method above fails you haven't got a lot to lose, though, so here here's the next thing I would try:
    Force Quit Indesign. See Replace Your Preferences and use the manual method to replace the InDesign Defaults and InDesign SavedData files (and while you're at it, make a backup copy of the InDesign Recovery folder). Also see Adobe Forums: InDesign crashes at startup and delete the additional files in John's post. If you need to delete or copy hidden files and don't know how to access them, see Access hidden user library files | Mac OS 10.7 Lion
    When all that is done, restart InDesign. With luck, autorecovery will open the file again with not much missing and you can try to save it.

  • I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix

    I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix.
    Why after 6 year's this has changed?
    I would like to open PDF's straight from Window Mail.

    Good day Jeff.
    I am running most current Adobe Reader X.
    Tks Mark

  • I get message:can't save library file not enough access privileges.Don't understand what this means?

    I get message:"Can't save library file.  Not enough access privileges" .Don't understand what this means. No visible effect that I can see now.

    Classic example of why you should save your workm in progress...just hit Ctrl+s to do it on the fly.
    Yes I know. But it is the first time I work with Photoshop on such a big project and I thought it would be more stable.. Do the newer versions manage the memory better ?
    You can shrink your image down which will make it smaller enough to save
    Not enough memory to resize the image. And in the manipulation, it would corrupt some of my layers..
    you can try to save as a diffeent format
    I could succesfully save in Bitmap format. But I lose all my layers info..
    The making loads of screen shots would be good if it wasnt really an
    option seeing as it would use even more memory to do that then put the
    image together out of the screen shots.
    I made screen shots without any problem. I saved them through MS Paint without any memory problem, while Photoshop in parallel was just used as a static image for snapping...

  • CS6 can not save files over 2GB???????

    I need to make a giant poster at 6ft wide x 5 ft tall. I created a blank document in CS6 at 200ppi. I created some text, and imported a couple of 25MB images. I am unable to save the file as a .PSD because it indicates that PS can not save files over 2GB.
    1. How did this file grow to become over 2GB?
    2. Why can PS not save a .PSD over 2GB?
    3. What do you do if you need to create a large format print such as this?
    Thanks in advance.

    Very true.
    However, Jeff knows exactly what he's doing and he's very, very good at it.  If your image were fortunate enough to end up being printed by Jeff Schewe, he'd be able to tell you exactly what kind of an image file he wants from you. 
    Always check with the printer.

  • I have an iMac(mid2010) running Pages v5.5.1 on OS X 10.10. Why can I not save or share documents. The error message is You can't save the file "TEST.pages" because the volume is read only.

    I have an iMac(mid2010) running Pages v5.5.1 on OS X 10.10. Why can I not save or share documents. The error message is You can’t save the file “TEST.pages” because the volume is read only.
    I get the same message when using Numbers so I presume it is a OS problem

    Some of your user files (not system files) have incorrect permissions or are locked. This procedure will unlock those files and reset their ownership, permissions, and access controls to the default. If you've intentionally set special values for those attributes, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it, but you do need to follow the instructions below.
    Back up all data before proceeding.
    Step 1
    If you have more than one user, and the one in question is not an administrator, then go to Step 2.
    Enter the following command in the Terminal window in the same way as before (triple-click, copy, and paste):
    sudo find ~ $TMPDIR.. -exec chflags -h nouchg,nouappnd,noschg,nosappnd {} + -exec chown -h $UID {} + -exec chmod +rw {} + -exec chmod -h -N {} + -type d -exec chmod -h +x {} + 2>&-
    You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take several minutes to run, depending on how many files you have. Wait for a new line ending in a dollar sign ($) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1, if you prefer not to take it, or if it doesn't solve the problem.
    Start up in Recovery mode. When the OS X Utilities screen appears, select
              Utilities ▹ Terminal
    from the menu bar. A Terminal window will open. In that window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your startup volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button
    Select
               ▹ Restart
    from the menu bar.

  • Since upgarding to Lion I can not save e-mails to files. E-mail does not responding, Why is this?

    Since upgarding to Lion I can not save e-mails to files.
    I always get the message E-mail is not responding, Why is this?

    Since upgarding to Lion I can not save e-mails to files.
    I always get the message E-mail is not responding, Why is this?

  • Downloaded aquarium screen saver. Says can not find Resource file

    Downloaded Auaruim screen saver, installed it, but can not find Resource File.

    >Funnily enough it loaded on an old pc easily!
    Hi
    This means that drivers are ok and there must be something wrong with the system preinstalled on Equium U400.
    How did you proceed?
    Its important that you would NOT connect the Dynadock to the notebook before the drivers and software installation has not been finished.
    Therefore you have to install the software firstly. Then after new reboot connect the Dynadock to the notebook and the installation would finish the next steps.

  • When i try to download firefox onto this computer, It downloads and says run or save. I click run and it says that it can not create temporary files. How do i fix this?

    I try to download firefox but it comes up with a error message saying it can not create temporary files.

    Beginning with Firefox 4, Macs must have an Intel x86 processor ('''''yours is a PPC Mac''''') '''''<u>and</u>''''' OSX 10.5 or higher ('''''which you do not have''''').
    *System Requirements: [https://www.mozilla.org/en-US/firefox/4.0/system-requirements/index.html Firefox 4] [https://www.mozilla.org/en-US/firefox/5.0/system-requirements/index.html Firefox 5] [https://www.mozilla.org/en-US/firefox/6.0/system-requirements/index.html Firefox 6] [https://www.mozilla.org/en-US/firefox/7.0/system-requirements/index.html Firefox 7] [https://www.mozilla.org/en-US/firefox/8.0/system-requirements/index.html Firefox 8] [https://www.mozilla.org/en-US/firefox/9.0/system-requirements/index.html Firefox 9]
    '''''The good news''''' is that Firefox 3.6.x still supports OSX 10.4 and Macs with the PPC Mac architecture. '''''The bad news''''' is that support for the Firefox 3.6.x series is likely to end in the first quarter of 2012.
    *System requirements: [https://www.mozilla.org/en-US/firefox/3.6/system-requirements/index.html Firefox 3.6.x]
    *Download Firefox 3.6.x: https://www.mozilla.org/en-US/firefox/all-older.html
    *Also see --> http://support.mozilla.com/en-US/kb/Installing+Firefox+on+Mac
    You can try the third-party product '''''TenFourFox''''' that supports PPC Macs with OSX 10.4.11 and OSX 10.5.8. Firefox 9 version of '''''TenFourFox''''' is available. The product is based on Firefox released versions. All support is provided by the developer, not by this site:
    *Home page: http://www.floodgap.com/software/tenfourfox/
    *Developer's blog: http://tenfourfox.blogspot.com/
    *'''''VERY IMPORTANT'''''; '''read this carefully''': https://code.google.com/p/tenfourfox/wiki/ReleaseNotes90
    *'''''VERY IMPORTANT'''''; '''read this carefully''': https://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

Maybe you are looking for

  • Laserjet pro mfp m177fw - cannot install print cartridge

    I recently purchased my printer, and now I have to replace the black cartridge for the first time. The graphics on the printer cartridge itself, and the videos on the HP site are not of any help. the directions say to insert the cartridge into the sl

  • H:outputText not display carrige returns

    I have a outputText tag <h:outputText value="#{displayParts.marketingDesc}" styleClass="marketingText" /> in a jsp page that is not displaying what is in the database I'm connected to. When the page is renedered I'm expecting the outputText to look l

  • Plan table output

    Hello guys, I am on a 9.2.0.7.0, and i am trying to get explain plan for one select that is reading some table through the db link at the remote sight. Unfortunately, i am getting this output :   1* select * from table(dbms_xplan.display) PLAN_TABLE_

  • CO document not created while billing

    Hi, When a sales document is released to accounting, the controlling document is not being generated. The following documents are being generated. Accounting document Profitability Analysis document Special purpose ledger document. Could you please h

  • IMovie and MacBook

    Hi, I've been a Windows user my whole life, although I have used Mac OS a lot at school, and I really like it. Anyways, I'm looking into buying a laptop for video editing, and am loosely looking at these MacBooks. iMovie says it needs 256 MB of RAM.