Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3791910
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:32:29+00:00 2026-05-19T12:32:29+00:00

I have a problem about streaming my video to server in real-time from my

  • 0

I have a problem about streaming my video to server in real-time from my phone.
that is , let my phone be a IP Camera , and server can watch the live video from my phone

I have googled many many solutions,
but there is no one can solve my problem.
I use MediaRecorder to record .
it can save video file in the SD card correctly.
then , I refered this page and used some method as followings

 skt = new Socket(InetAddress.getByName(hostname),port);
 pfd =ParcelFileDescriptor.fromSocket(skt);
 mediaRecorder.setOutputFile(pfd.getFileDescriptor());

now it seems I can send the video stream while recording

however, I wrote a receiver-side program to receive the video stream from Android ,
but it doesn’t work . is there any error?
I can receive file , but I can not open the video file .
I guess the problem may caused by file format ?

there are outline of my code.

in android side

    Socket skt = new Socket(hostIP,port);
ParcelFileDescriptor pfd =ParcelFileDescriptor.fromSocket(skt);
....
....
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setOutputFile(pfd.getFileDescriptor());
.....
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
.....
mediaRecorder.start();

in receiver side (my ACER notebook)

// anyway , I don't think the file extentions will do any effect                
File video = new File (strDate+".3gpp");
FileOutputStream fos;
try {
fos = new FileOutputStream(video);

byte[] data = new byte[1024];

int count =-1;

while( (count = fin.read(data,0,1024) ) !=-1)
{
    fos.write(data,0,count);                                
    fos.flush();    
}                                       
fos.close();
fin.close();

I confused a long time….
thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:32:30+00:00Added an answer on May 19, 2026 at 12:32 pm

    Poc,

    The way MediaRecorder writes files is as follows:
    Leave space for empty header
    Write file contents while recording
    When recording finishes, seek to the beginning of file
    Write the header at the beginning of the file
    Then (I believe) there is another seek to the end of the file where metadata is written.

    Because there is no concept of “seeking” on a socket, you will have to figure out when the header comes, seek to the beginning of your file, and then write the header in the appropriate location.

    The best place to start here is to use a hexeditor to determine the format of a valid 3gpp file, then analyze this hex against your receiver program’s hex output. Also you will want to look into 3gpp file formats.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tricky problem that I've been messing about with for a few
I'm confused about how VideoView can be used to play video: from a local
I'm trying to set up a web server that will support streaming video to
I have hit upon this problem about whether to use bignums in my language
The problem is not about randomness itself (we have rand), but in cryptographically secure
I've been thinking about this problem for a while and have yet to come
I have a fairly simple sync problem. I have a table with about 10
I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a flex 3 app that uses netstream and a video object to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.