pquiring / javaforce

JavaForce library for building powerful Apps and Services (Native Bindings for Camera, OpenGL, ffmpeg). Includes VoIP stack, PLC I/O and many apps.
http://pquiring.github.io/javaforce
GNU Lesser General Public License v3.0
55 stars 24 forks source link

RTP VP8 Codec #1

Closed ffalanga closed 7 years ago

ffalanga commented 8 years ago

Hi, I need to save an RTP stream with codec VP8, in a video file (from java code). I have read all RTP packets, and I have saved in a RAW file (without meta information). How I can add the correct header file, to play it? How I can save all packets in a correct "webm" file? Please can you help me?

Thanks in advance Francesco

pquiring commented 8 years ago

I could implement a record video function in my jPhoneLite VoIP phone which supports VP8. It already has a record audio function (.wav).

Or have a look at the webm source code: https://chromium.googlesource.com/webm/libwebm/+/master

The raw video in the RTP packets would have a header you need to strip off, plus another byte in some packets. See: https://github.com/pquiring/javaforce/blob/master/src/javaforce/voip/RTPVP8.java

Did you also look at ffmpeg? That is what my apps use to support VP8 anyways.

ffalanga commented 8 years ago

Thanks very much, for the quick answer. Maybe, my question is more easy, I have captured all RTP packets, I need just to save them in a file on the system, to play it in a second time (I need record the video stream). I need to understand how create the file on the system with the right meta-data.

Thanks in advance Francesco

pquiring commented 8 years ago

I'm sure ffmpeg can do it. Just need to play with the command line switches.

ffalanga commented 8 years ago

I have used your "RTPVP8" "decode" function, to get the byte[] and save in a file without extension. Now I have tried some options to convert the file in a correct "webm", but without success. My rtp stream has the followings metadata (I have read them with Wireshark): Media Type = 120 (vp8) Sample rate = 90000 max-fs=12288 max-fr=60

Please can suggest me how convert my RAW file in a correct webm o mpeg4? Something like: ffmpeg -f vp8 -i file.raw outoput.webm

Thanks again Francesco

ffalanga commented 8 years ago

In the "JPhoneLite", there is the "Record" class, that implement the "writeHeader" method for an audio file. I need the same things ("writeHeader"), for "vp8" codec file. Please can you help me?

Thanks again Francesco

pquiring commented 4 years ago

Hi ffanlanga,

JavaForce has made many improvements since we last talked. The MediaEncoder might be able to do what you were looking for. Look at: https://github.com/pquiring/javaforce/blob/master/src/javaforce/media/MediaEncoder.java Look at the addVideoEncoded() function. It's in native code but I think it's what you were looking for. It takes pre-encoded video and adds to a media container. I use it to add H.264 raw streams into mp4 files but the same could probably work with VP8 files. This process is used in the DVR project.

Cheers,

pquiring commented 4 years ago

In fact, look at this source: https://github.com/pquiring/javaforce/blob/master/projects/jfdvr/src/CameraWorker.java It takes RTP H264 packets and saves them into MP4 files. Would be very close to VP8.