3

I wish to play a video in JFrame. I am already using ffmpeg in my project. As I wish to keep the project light, I am not willing to use other frameworks like JMF or other. I know that I can play video using ffplay. But the problem here is ffplay opens the video in new window when I try

ffplay output.avi

I wish to put that video within my JFrame, like a player. How can I do this?

Request: Please ask for any other clarifications, details, and suggest improvements or comment what you find wrong before downvoting or voting to close the question:). I will change it. I am really new to Java, I tried searching this but could not find any possible solution.

What I tried? I couln't find anything related to this, so I don't have any code. I am familiar to how to create frames, and can use runtime to ffplay video. But I got no clue how to put that video within my window:(.

All suggestions are welcome if you can suggest me other methods to play the video. But I haven't use any frameworks other than ffmpeg. And do not wish to make the application heavier. So it would be more helpful if it can be achieved using ffplay.

Optimus Prime
  • 6,817
  • 5
  • 32
  • 60

1 Answers1

0

Look at the JMF 2.1.1 - Supported Formats. If the video types you wish to support are covered by the cross-platform1 version of the JMF, or you can find an SPI for the format, I'd say use JMF.

  1. The 'performance pack' version uses natives which are now very old. I would not recommend trying to use them.
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • `jmf` adds >2 mbs to the project. Is it not possible using ffplay? – Optimus Prime Jul 22 '13 at 13:48
  • *"Is it not possible using ffplay?"* No idea. How much does ffplay add the project? – Andrew Thompson Jul 22 '13 at 14:04
  • ffmpeg package is 10 mb. But I am already using it so it is not adding anything extra. – Optimus Prime Jul 22 '13 at 17:49
  • Odd comment to make. The way I figure it, the user user is around 8 MB better off (smaller download) using the core JMF over ffplay. – Andrew Thompson Jul 22 '13 at 18:58
  • No but I am already using ffmpeg to convert images, concatenate audios, then also convert to videos, cut video clips, concatenate them later and other things too. Thats why I said ffmpeg is already being used, thus jmf would be additional. – Optimus Prime Jul 23 '13 at 14:13
  • You keep using the word 'I' like this app. is only for your personal use & there are no other users. Is that the case? – Andrew Thompson Jul 23 '13 at 14:15
  • No, I mean I am using ffmpeg to convert images to video on client side, the users aren't even aware of that, they would just be using my app right? Not `ffmpeg`. If the app would have been only for me, I wouldn't think twice about using jmf. – Optimus Prime Jul 24 '13 at 05:50
  • *"..the users aren't even aware of that,.."* They might be aware of the extra 8 Meg difference between JMF & ffmpeg. *"they would just be using my app right?"* ..same difference with JMF. It comes in it's own (obvious) installer, but for the x-plat version, you can side-step the JMF installer entirely and just include the jars. You're not laboring under the delusion that ffmpeg comes per-installed on the user's machine (e.g. 'supplied with the OS'), right? – Andrew Thompson Jul 24 '13 at 06:01
  • No, I know I would have to tell them to download that, but jmf too will have to be downloaded. So, I was trying to reduce what they need to download, but looks like now I should use jmf instead of wasting time on this. – Optimus Prime Jul 24 '13 at 06:04