Java Forum / General / November 2005
Splice Video in JMF
Bruce Lee - 09 Nov 2005 12:29 GMT Hi, does anyone know if I can chop say the 1st 500Kb from a video and play that in JMF (Java Media Framework)?
Roedy Green - 09 Nov 2005 13:34 GMT On Wed, 09 Nov 2005 12:29:42 GMT, "Bruce Lee" <blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone who said :
>Hi, does anyone know if I can chop say the 1st 500Kb from a video and play >that in JMF (Java Media Framework)? You would look for an editing utility. try googling on "whateverformat editor"
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Bruce Lee - 09 Nov 2005 13:47 GMT > On Wed, 09 Nov 2005 12:29:42 GMT, "Bruce Lee" > <blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 8 lines] > Canadian Mind Products, Roedy Green. > http://mindprod.com Java custom programming, consulting and coaching. Can I not just grab the raw bytes in a buffer and convert them into a DataSource and push them through the Player?
zero - 09 Nov 2005 17:20 GMT "Bruce Lee" <blah@blahbllbllahblah.com> wrote in news:v5ncf.30821$j5.5761 @fe1.news.blueyonder.co.uk:
>> On Wed, 09 Nov 2005 12:29:42 GMT, "Bruce Lee" >> <blah@blahbllbllahblah.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 12 lines] > Can I not just grab the raw bytes in a buffer and convert them into a > DataSource and push them through the Player? I'm guessing no. How would the player know what format it is? Some formats play fine as long as they have the header, but others need the whole file. And apart from that you'd probably get some very funky effects.
Bruce Lee - 09 Nov 2005 17:35 GMT > > Can I not just grab the raw bytes in a buffer and convert them into a > > DataSource and push them through the Player? [quoted text clipped - 3 lines] > whole file. And apart from that you'd probably get some very funky > effects. Some video files don't provide a meta header? Then how does the player know what codec to use?
Oliver Wong - 09 Nov 2005 23:13 GMT >> > Can I not just grab the raw bytes in a buffer and convert them into a >> > DataSource and push them through the Player? [quoted text clipped - 7 lines] > know > what codec to use? They might try the file extension (e.g. .MOV is probably Apple Quicktime).
If you're talking about .AVI files, the AVI format is actually a container format, and it should always have the FourCC info specifying a codec to use.
Otherwise, theoretically, there's no way to know for sure what kind of file you've got. I could design a file format for storing a boolean value such that the file representing true is defined to be equivalent to the DVDRip of Star Wars Episode III encoded via DivX and mp3 with specific quality settings, and the boolean value for false is the DVDRip of Saw 2 with the same codec and settings. Given just the contents of one of these files (let's say the Star Wars one), it is absolutely impossible for you to know whether the data is supposed to represent the Star Wars movie, or the value "true" for my custom application.
To answer the OP's original question, the way data is stored is entirely codec dependant. DivX and XviD for example, both allow storing frames out of order, so just take the "first 500Kb" for example might not even yield a continuous set of frames. You could imagine a codec where it is impossible to know the contents of any particular pixel of any particular frame without seeing the whole stream (it'd be a dumb codec, but a perfectly legal one).
If you only want, for example, the first N seconds of video footage, then in general, you will have to actually decode the video stream, extract the relevant frames, and optionally re-encode them into a file (if you want to save a "preview" file, for example).
- Oliver
Roedy Green - 10 Nov 2005 01:03 GMT >How would the player know what format it is? Some >formats play fine as long as they have the header, but others need the >whole file. Have you noticed that pornographic clips come in two flavours, ones that stream -- start playing after buffering the initial stream and some require the entire clip downloaded before starting to play.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Andrew Thompson - 10 Nov 2005 01:43 GMT >>How would the player know what format it is? Some >>formats play fine as long as they have the header, but others need the >>whole file. > > Have you noticed that pornographic clips .. ..'pornographic'?
Why are you projecting your viewing tastes to others?
( It seems rather odd you would think that is OK to project that onto others, given your own dislike of any implied drug use on your part. No? Some people find pornography (the every concept) to be quite disgusting*, and their are any number of regions where you might face legal action from even attempting to access a variety of levels of 'erotica'. )
* FTR - I am not one of them - porn has it's place, but not necessarily being referred to in the 'ways and circumstances' above.
Roedy Green - 10 Nov 2005 01:52 GMT On Thu, 10 Nov 2005 01:43:33 GMT, Andrew Thompson <seemysites@www.invalid> wrote, quoted or indirectly quoted someone who said :
>Why are you projecting your viewing tastes to others? Given how the porn industry financially drives the home consumer side of the net, I would expect all Java programmers to examine the delivery technology.
Not all porn is the type Scooter Libby and George W Bush have custom made for them in Iraq with child rape by attack dogs.
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
Luc The Perverse - 10 Nov 2005 02:12 GMT >>Why are you projecting your viewing tastes to others? > Given how the porn industry financially drives the home consumer side > of the net, I would expect all Java programmers to examine the > delivery technology. I agree.
> Not all porn is the type Scooter Libby and George W Bush have custom > made for them in Iraq with child rape by attack dogs. Um . . .
Living under the tyranny of the Bush Administration - I fear I might be arrested if I were to reply to that.
-- LTP
:) Andrew Thompson - 10 Nov 2005 02:25 GMT > On Thu, 10 Nov 2005 01:43:33 GMT, Andrew Thompson > <seemysites@www.invalid> wrote, quoted or indirectly quoted someone [quoted text clipped - 5 lines] > of the net, I would expect all Java programmers to examine the > delivery technology. The delivery technology is an entirely different thing to the content.
[ FYI They also make some recordings of things like, sport, current affairs, the weather, nature docos., political or social commentaries, plays, humor skits, TV ads, How-To's... ]
> Not all porn .. Who cares what all porn 'is' or 'is not'?
The finer distinctions of the nature of 'types of porn' is ancillary to my point. 'Porn' is a 'somewhat less than innocent' form of content that might be delivered by the technologies, but there is no reason to expect that others have 'observed this effect when trawling the net for porn', as your statement seems to imply.
[ And, just as a trivial aside - since I get all my porn via a file swapping program, I can only watch it when it is fully downloaded, *irrespective* of what format it is! OTOH I *have* noticed the effect to which you refer when downloading (in a browser) some of the *horrendously* long vid's from NASA and such. Some formats will start playing before complete, others you have to wait for the entire file before you see anything (entirely unconnected with the *content* - harumph!). ]
Oliver Wong - 10 Nov 2005 15:28 GMT > [ And, just as a trivial aside - since I get all my porn via > a file swapping program, I can only watch it when it is > fully downloaded, *irrespective* of what format it is! Depending on the file swapping program you use, some of them have a feature to give priorities to "chunks" of the file which are most likely to yield a viewable partially downloaded file. Most video formats, for example, either have the meta-data required to decode the stream in either the head or the tail of the file, so the algorithm the file sharing program is typically to put highest priority on the 1st meg, then the Nth meg (assuming a file of size N), then the 2nd meg, 3rd meg and so on, with the N-1th meg having the lowest priority.
With a good enough connection/peer set, you could start watching the movie as soon as the required meta data has downloaded, and the chunks would come in as you needed them. This "good enough" situation has never occured for me in practice though. However, the feature IS useful to just watch the first 30 seconds or so of a clip to make sure it hasn't been mislabeled.
- Oliver
Julian McMaster - 10 Nov 2005 03:02 GMT Not in the good US of A. If porn were to be restricted here, I'd estimate 80 to 90% of the home Internet traffic would cease...which means the big ISPs that are making a killing from their broadband fees would lose tons of money...and as we all know... $$$ drives America!
>>>How would the player know what format it is? Some formats play fine as >>>long as they have the header, but others need the whole file. [quoted text clipped - 16 lines] > necessarily being referred to in the 'ways and circumstances' > above. Luc The Perverse - 10 Nov 2005 03:39 GMT > Not in the good US of A. If porn were to be restricted here, I'd estimate > 80 to 90% of the home Internet traffic would cease...which means the big > ISPs that are making a killing from their broadband fees would lose tons > of money...and as we all know... $$$ drives America! There is a war on porn in the USA.
It is kinda funny. If it fails, then it is just another joke. If it succeeds, people will get mad and it will be revoked.
-- LTP
:) Oliver Wong - 10 Nov 2005 15:31 GMT > Not in the good US of A. If porn were to be restricted here, I'd estimate > 80 to 90% of the home Internet traffic would cease...which means the big > ISPs that are making a killing from their broadband fees would lose tons > of money...and as we all know... $$$ drives America! [snip]
>> Some people find pornography (the every concept) to be quite >> disgusting*, and their are any number of regions where you might [quoted text clipped - 4 lines] >> necessarily being referred to in the 'ways and circumstances' >> above. I think Andrew is saying SOME forms of Pornography are restricted, and I believe that is indeed the case in the US of A. IANAL, but as I recall, child pornography is illegal everywhere in the USA, and bestiality is illegal in some parts but not others.
I also wouldn't be too surprised if certain forms of gay or lesbian porn were outlawed in small counties or municipalities.
- Oliver
JScoobyCed - 10 Nov 2005 02:21 GMT > Hi, does anyone know if I can chop say the 1st 500Kb from a video and play > that in JMF (Java Media Framework)? Actually, if you look at the code samples in JMF, there is a video editing tool. It's very simple stuff, but could guide you to what you need. But as some people replied here, you might need in some cases to load the whole file before cutting off the part you need
 Signature JSC
Andrew Thompson - 10 Nov 2005 02:31 GMT >> Hi, does anyone know if I can chop say the 1st 500Kb from a video and >> play [quoted text clipped - 4 lines] > But as some people replied here, you might need in some cases to load > the whole file before cutting off the part you need Oh. And as an aside, I am not sure if this has been mentioned yet in the thread, but it will probably be easier to trim a vid. to the last 'nnnn' mseconds, or the last 'nnn' frames, than a specific number of Kb.
Compression algorithms for images can be quite complex, and animated sequences (videos and movies) even more so. Generally, the longer(/bigger) the content you have, the more efficient the storage compression.
Bruce Lee - 11 Nov 2005 13:43 GMT >Oliver Wong: >"Most video formats, for example, >either have the meta-data required to decode the stream in either the head >or the tail of the file In the tail? What's the point in that?
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|