Splice Video in JMF

B

Bruce Lee

Hi, does anyone know if I can chop say the 1st 500Kb from a video and play
that in JMF (Java Media Framework)?
 
R

Roedy Green

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"
 
B

Bruce Lee

Roedy Green said:
You would look for an editing utility. try googling on
"whateverformat editor"

Can I not just grab the raw bytes in a buffer and convert them into a
DataSource and push them through the Player?
 
Z

zero

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.
 
B

Bruce Lee

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.

Some video files don't provide a meta header? Then how does the player know
what codec to use?
 
O

Oliver Wong

Bruce Lee said:
Some video files don't provide a meta header? Then how does the player
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
 
R

Roedy Green

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.
 
A

Andrew Thompson

Roedy said:
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.
 
R

Roedy Green

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.
 
L

Luc The Perverse

Roedy Green said:
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.
 
J

JScoobyCed

Bruce said:
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
 
A

Andrew Thompson

Roedy said:
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.

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!). ]
 
A

Andrew Thompson

JScoobyCed said:
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

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.
 
J

Julian McMaster

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!
 
L

Luc The Perverse

Julian McMaster said:
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.
 
O

Oliver Wong

Andrew Thompson said:
[ 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
 
O

Oliver Wong

Julian McMaster said:
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!

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top