×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    38

    why the resolution decreases when the video file is sent to server

    Hello frens,

    I am sending the video files to server from device.
    on device the resolution of the video is 176*144.
    and on the server the resolution of the video file is
    176*63 and the file is not visible clearly on server.
    so please anyone can help me out from this problem


    Thanks-
    Ritu Singh

  2. #2
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: why the resolution decreases when the video file is sent to server

    I am not sure but are u sure the that the resolution of both files differ actually this is a case of format conversion by default a simple operation like uploading a file can not do the job of format conversion its a hectic process and if it does its a bizarre situation

    Do check that size of file on device side and on server side is same
    can U upload the files(both) to some place
    Regards,
    Saurabh

  3. #3
    Registered User
    Join Date
    Dec 2008
    Location
    Cochin, Kerala, India
    Posts
    84

    Smile Re: why the resolution decreases when the video file is sent to server

    Which code u used. May be the code mistake might be the problem.

    Reagards
    Vineeth K.

  4. #4
    Registered User
    Join Date
    Dec 2009
    Posts
    38

    Re: why the resolution decreases when the video file is sent to server

    thanks for your reply .

    i want to tell you that the video file size on server and on device is
    the same.both file size is same.when these files are played on desktop
    its resolution differs.so the video file which is on server is not clear.
    Here is the code which i am sending u so that u can be able to make
    out the solution easily.
    please help me out.

    and please do tell me one more thing that on server end i should have to set mime type also??
    for this,if yes then wat mime type should i set.
    public void recording()

    {

    try {



    for(i=0;i<4;i++)
    {
    Form da=new Form("recording");



    String PATH = System.getProperty("fileconn.dir.videos") + "video"+i+".mp4";


    player = Manager.createPlayer("capture://video");
    player.realize();

    record = (RecordControl)player.getControl("RecordControl");
    //record.setRecordSizeLimit(15000000);


    conn = (FileConnection)Connector.open(PATH,Connector.READ_WRITE);
    if(!conn.exists())
    conn.create();

    stream = conn.openOutputStream();
    record.setRecordStream(stream);

    control = (VideoControl)player.getControl("VideoControl");
    if (control != null) {



    da.append((Item)control.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,null));
    try {

    control.setDisplayFullScreen(true);
    } catch (MediaException ex) {
    ex.printStackTrace();
    }
    control.setVisible(true);
    //display.setCurrent(da);
    }

    //record.setRecordSizeLimit(100);
    time=player.getMediaTime ();
    record.startRecord();
    player.start();
    Thread.currentThread().sleep(20000);
    record.commit();
    player.stop();
    player.deallocate();
    player.close();
    conn.close();
    stream.close();
    try{
    //FileConnection fc = (FileConnection) Connector.open("file:///" +"root1/video"+i+".mp4");
    String SERVER_PATH="http://192.168.1.168/WebApplication1/NewServlet";
    //sending file to server!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    FileConnection fc=(FileConnection)Connector.open(PATH,Connector.READ_WRITE);
    InputStream is=fc.openInputStream();
    int len=(int)fc.fileSize();
    //InputStream im=fc.openInputStream();
    byte b[]=new byte[len];
    is.read(b);
    String str=new String(b);

    HttpConnection http=(HttpConnection)Connector.open(SERVER_PATH,Connector.READ_WRITE);
    http.setRequestMethod(HttpConnection.POST);
    http.setRequestProperty("Content-length", ""+b.length);
    http.setRequestProperty("Content-type", "video/mp4");


    OutputStream out=http.openOutputStream();
    //String filename="video"+i+".3gp";
    //String phone=System.getProperty(
    //byte file=filename.getbyte();
    //out.write(file
    //String phone="9717916966";

    if(i==0)
    {
    filename="recordphoneno="+emer1+"filename=video"+i+".mp4"+"latitude="+lat+"longitude="+lon+"IMEI="+imei9+"*";
    }
    else
    {

    filename="secondphoneno="+emer1+"filename=video"+i+".mp4*";
    }

    byte[] r=filename.getBytes();
    out.write(r);
    out.flush();
    out.write(b);





    out.flush();
    out.close();
    int rs=http.getResponseCode();
    System.out.println("!!!!!!!!!!!!"+rs+"!!!!!!!!!!!!!!!");

    http.close();

  5. #5
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: why the resolution decreases when the video file is sent to server

    try commenting this line and see the result

    PHP Code:
    //http.setRequestProperty("Content-type", "video/mp4"); 
    also if above line is necessary try to change it to content type to some what normal data file
    Regards,
    Saurabh

  6. #6
    Registered User
    Join Date
    Dec 2009
    Posts
    38

    Re: why the resolution decreases when the video file is sent to server

    thanx for ur reply...

    I have commented that line and then seen the result.
    the resolution differs.so now what changes
    should i make in code?

    thanx-
    Ritu

  7. #7
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: why the resolution decreases when the video file is sent to server

    following link might help U
    also try to set mime type to "multipart/form-data"
    Regards,
    Saurabh

  8. #8
    Registered User
    Join Date
    Dec 2009
    Posts
    38

    Re: why the resolution decreases when the video file is sent to server

    thanks for ur reply...

    but the thing is i am not using multipartformoutputstream.
    the videoclips are sent on server one by one.
    so should i set mime type at server end??

    Thanks -
    Ritu Singh

  9. #9
    Super Contributor
    Join Date
    Apr 2009
    Posts
    572

    Re: why the resolution decreases when the video file is sent to server

    Well I dont think one has to set mime type on server side too
    Few things I think that should does help you out might be

    Install media codec pack on your server machine if you think that server side mime type is to be defined

    Also as the java doc suggest the content type should contain the value that best describes your data type so it better to retain it programmatically rather than hardcoding as video/mp4 as their is no mime type of such type in java rather can try only video

    The above two suggestion can be tried with experimenting all scenarios but I m not sure that it will work it just a guess

    Meanwhile here is codefor uploading a video file to server might help for more info on this code
    Last edited by ingsaurabh; 2010-02-04 at 13:16.
    Regards,
    Saurabh

  10. #10
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: why the resolution decreases when the video file is sent to server

    Quote Originally Posted by ritusingh View Post
    FileConnection fc=(FileConnection)Connector.open(PATH,Connector.READ_WRITE);
    InputStream is=fc.openInputStream();
    int len=(int)fc.fileSize();
    //InputStream im=fc.openInputStream();
    byte b[]=new byte[len];
    is.read(b);
    String str=new String(b);
    OK... first problem:

    Code:
    is.read(b);
    This might not read the entire file. Read Reading an InputStream in Java ME.

    Also:

    Code:
    String str=new String(b);
    Not sure why you want to do this.

    Quote Originally Posted by ritusingh View Post
    Code:
    http.setRequestProperty("Content-type", "video/mp4");
    The MIME type is purely for conversation between your client and your server applications. Since you appear to be sending a file name before the video data, you are not sending a "video/mp4" stream. Don't set this if you don't know what you are sending.

    Quote Originally Posted by ritusingh View Post
    Code:
       out.write(r);
       out.flush();
       out.write(b);
     out.flush();
    No need to keep flushing the stream. Don't flush streams unless you need to.

    Graham.

  11. #11
    Registered User
    Join Date
    Dec 2009
    Posts
    38

    Re: why the resolution decreases when the video file is sent to server

    thanks for ur reply....

    I have tried reading the data in single byte as mentioned in the link u have send.
    But still unable to get the clear video at the server end.
    the video files are blurred.Can u please tell me what else i should do so that
    the video files can become visible as it is on device.

    thanks-
    Ritu Singh

Similar Threads

  1. MBM image is not found
    By tamhanna in forum Symbian
    Replies: 14
    Last Post: 2009-04-20, 12:44
  2. Problem with pyobfuscate
    By JOM in forum Symbian
    Replies: 3
    Last Post: 2008-06-20, 22:47
  3. Replies: 7
    Last Post: 2007-03-28, 08:53

Posting Permissions

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