Firstly, we have a video in localstorage (say Drive D), and We are reading the video by converting into the bytes and passing it to inputstreamreader and working fine. Our doubt is that, how can we allow user to forward and backward the video while playing , since we are passing the bytes in a sequential manner, how it can be achieved to forward or backward the video while streaming. Please suggest us in a right way. Thanks in advance.
Related
Using javax.sound.midi i've managed to open my midi device up for outputting a .midi file in the past but the issue is i need to be able to pickup the midievent in it's raw form as in "3C40"/"903C40".
I'm able to find documentation on opening transmitters/receivers/sequencers but no code examples using these to output to say a string as the raw data from the midi device example of which is my yamaha ypt-240
digital keyboard.
Basically the reasoning behind why i want this raw data is to make some simple keybindings that would be triggered by said raw data from the midi device almost like a stream deck or using software that allows this.
The ShortMessage seems like the way to go but again can't find any code using it the way i would like to.
Every example is mididevice||file.midi -> synth||mididevice
I need a way to intercept that input java is getting from the device...
please help lol
is there a way to detect either a Video or Audio track present in a raw MP4 data?
I have downloaded a raw MP4 data (with some size) from a URL with a range request. It is not a full MP4 data.
I am using MP4Parser to do this job.
What I have tried is I am trying to build a Movie object from the above MP4 data. But it throws exception saying that there are no tracks in it.
Any idea would be much appreciated how to construct Movie object from a raw MP4 data.
Thanks
without the original moov box, the file is pretty much worthless. It is possible to locate the frames in the mdat and reconstruct a new moov with some forensic analysis, but its almost certainly not work the effort or cost dot so.
I'm a bit stuck on a question actually and i reaaly hope that someone can help me with this issue.
My problem is as follows :
I have a live usb camera with which i'm encoding only the video in h264 in order to send it with RTP over the network to a receiver (my receiver here for test purposes is Ekiga).
After having encoded only the video in h264, i have a byte array.
Now with this byte array, i want to extract the SPS and PPS. I want to get these information for me to be able to send the following sequence when sending frames to the receiver :
SPS => PPS => FRAME 1 (coded slice of an IDR picture) => FRAME 2 (non coded slice of an IDR picture) => FRAME 3 (non coded slice of an IDR picture) => and so on ...
How can i extract those information and i want a JAVA library which can help me? (JCODEC nop docs??!!)
Thanks for your help.
Ronnie
It depends on your encoder. If it is producing annex b stream the sps/pps are most likely the first and second Nalus. Unless it is also producing access unit delimiters in which case it will be second and third. If it is not producing annex b then this data will need to be obtained from the encoders API another way. Either way you will need to parse the stream. You can see more details here.
Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream
One more thing a NALU is NOT the same thing as a frame. A frame can be made up of Many NALs.
Thanks for your help and answer. Well, my researches and works continue (i'm a newbie in this domain) and i have been able to transmit my video to the receiver. The receiver here is Jitsi which i'm using for test purposes.
I've seen too the link which you provided me and from it, i did understand many things which weren't totally clear.
Now, my actual problem is with the quality of the video i am receiving in Jitsi. In fact, i'm using Xuggler for encoding my orginal video (streaming from my webcam) to H264 format. When Xuggler encode my video, i can now see the correct SPS, PPS and SEI headers and you are right i can notice too many NALs which make up my frame to be transmitted over the network.
I think that it would be better to use another library than Xuggler but there comes my real problem. JCodec, there's no documentations and from what i have read, it's a bit slow in processing H264 videos.
Can you please guide me in the choice of a good library which can help me in encoding and decoding H264 video streams?
Does anyone know a library in Java which can do that for me and some documentations associated with this library?
Thanks for your help.
Ronnie
I have used xuggler to play audio files other than wav,au,aiff. Since xuggler performs audio decoding at low level it is very hard to write a method that both forwards and rewinds the audio being played . ( while decoding xuggler analyzes each data packet and then sends it to play)
One way could be read bunch of packets at a time and then send the next packet to play.This way the effect of forwarding audio can be felt . But i don't know how to implement this method Moreover this is not the best way i can forward the data.
Are there any direct methods to forward and rewind audio ? If not direct what is the algorithm , steps to do this ?
Have you looked at the seekKeyFrame() method in IContainer? See here. On seek, you could just flush the dataline and then on execution of the method the container should jump to the given location.
If you want to do it by a percentage call, then getDuration() gets the entire length of the stream (if available.) You can then work out accurate timestamps from there.
I need to split mpeg4 video stream (actually from android video camera) to send it through RTP.
The specification is little large for quick reference.
I wonder if there any example/open source code for mpeg4 packetization?
Thanks for any help !
Mpeg4 file format is also called ISO/IEC 14496-14. Google it any you will find specifications.
However, what you are trying to do (RTP publisher) will be hard for the following reasons:
Mpeg4 has header at the end of the file. Which means header will be written out only when video stream is finished. Since you want to do real time video streaming you will need to guess where audio and video packets start/end. This will not be the same on all Android devices as they might use different video sizes and codec parameters. So your code will be device-dependent and you'll need to support and test many different devices.
Some devices do not flush video data to file in regular intervals. Some only flush once a minute or so. This will break your real-time stream.
There is no example code. I know because I looked. There are a few companies that do something similar, but mainly they skip RTP. Instead they progressively upload the file to their own server and then implement video/audio stream "chopping" and then insert it into their video/transcoder backend. I used to work for one of those companies and that's how we did it. AFAIK competition took similar approaches. The upside is that all complexity is on server an you do not need to update clients when something breaks or new devices arrive on the market.