Is it possible to play an embedded AAC file in Flash/Flex somehow? I know you can playback embedded MP3 files, but I hear that you can't do that with AAC. Anyone know any sneaky ways to get around this?
By way of illustration, here's come code.
[Embed(source='../../audio/music02.m4a', mimeType="audio/aac")]
private static const __ExampleMp4File:Class;
public var myMp4Sound:Sound = new __ExampleMp4File();
public function EmbeddedAudioTest()
{
myMp4Sound.play();
}
Unfortunately you can't. If you convert the audio file to video with just an audio track, then you can play it.
This does seem like a silly oversight in the player since it has support for playing embedded sound and support for AAC embedded in video.
Related
Hey folks I'm trying to save video from a video tag.
This is part of a scraping exercise on Tiktok and I cannot use the url directly to save the video, either in the browser or server.
I also cannot use canvases as I'm getting a tainted canvas error.
What would be the best way to save the video data?
// Example code
let video = document.querySelector('video');
let src = video.src;
// Do something with the el or the source??
I have a JavaFX application which uses a MediaPlayer and a MediaView to play videos. I've been testing with some mp4 video's I have and it works perfectly fine, audio, visuals, all looks good. Only not for a specific type of mp4 video.
I have the full series of a show I like on my hard drive, and for some reason when I try it with ANY of those videos, I can see the video play perfectly but the audio is just not there. The MediaPlayer is not muted, and the volume is at 1.0 (100%). When I use an AudioSpectrumListener it doesn't even fire, but it does with other videos.
I doubt the code matters since it works fine for any other video, but I'll put it anyways. I'm using an MVC design pattern, so the MediaPlayer is stored in a model object.
public void openVideo() {
File selectedFile = chooseFiles(VIDEO_EXTENSIONS); // opens file chooser for given extensions
if (selectedFile == null) return;
if (dataModel.getVideoPlayer() != null) dataModel.getVideoPlayer().dispose();
dataModel.setVideoPlayer(new MediaPlayer(new Media(selectedFile.toURI().toString())));
dataModel.getVideoPlayer().play();
}
The MediaView is bound to the MediaPlayer in the data model through this line of code:
mediaView.mediaPlayerProperty().bindBidirectional(dataModel.videoPlayerProperty());
The videos that don't work are all about 22 minutes long and 1GB in size. I've attached a screenshot of the properties of a video that works fine, and one which doesn't play the audio.
Works fine, this is a screen recording I made with OBS.
Won't play audio, episode of a show I like to watch.
The only audio-difference is the bit rate, something I don't think should make any difference.
I am starting to think this may be a bug with javaFX, but I really hope that there's something I can do to make this work.
I tried to display a "mjpeg webcam url" on my javafx application but nothing shows
Code is:
#FXML
private MediaView mediaView;
...
Media media = new Media("http://192.165.96.36/mjpg/video.mjpg");
MediaPlayer player = new MediaPlayer(media);
player.setAutoPlay(true);
mediaView.setMediaPlayer(player);
mediaView.setVisible(true);
Do you know how can I display mjpeg url videos ?
Thanks
As far as I know, only the following video formats are supported:
FLV containing VP6 video and MP3 audio; MPEG-4 multimedia container with H.264/AVC (Advanced Video Coding) video compression
So you'll first have to transcode your video to h.264 (try ffmpeg).
As a comitter of the mjpegstreamer OpenSource project I'd recommend to try
out the latest version of:
https://github.com/BITPlan/com.bitplan.mjpegstreamer
As of 2019-02 it's being ported to JavaFX. You might want to raise issues as you see needs that are not fullfilled.
Since it's opensource you can also see how the mjpeg videos are handled.
I have this application where I display content together with a video file. The video files are either in image/jpeg (MJPG format according to vlc) or video/x-h264 format.
To do this, I use a mediasource combined with a video output element to display the video. This is working perfectly when using h264. However, this is not working at all with the mjpg video files.
But I have no idea how to do this. I have read up on libraries using either ffmpeg or vlc, but I can't seem to find libraries to use in combination with QML elements, only with regular QWidgets.
Here is some (stripped down) relevant code, it is really simple and I would prefer to keep it simple. So ideally I am just looking for a way to get a codec into the project or something like that.
property string videoLocation
FileDialog {
id: videoFileDialog
onAccepted: {
videoLocation = fileUrl
}
}
MediaPlayer {
id: mediaplayer
source: videoLocation
autoPlay: false
}
VideoOutput {
id: videoOutput
source: mediaplayer
}
Maybe relevant:
my system is ubuntu 13.04 and I use qt 5.3.
Thx in advance
EDIT: I have figured out the problem I think: The stream is recorded using gstreamer > 1.0. For some reason it won't play back in 0.10. If I record using the same settings, but with gstreamer 0.10, everything is fine and my application works (though this option is not feasible, I really need to capture using > 1)
Here is the code I am using to capture the stream to a file:
gst-launch-0.10 v4l2src device=/dev/cam1 ! image/jpeg,width=320,height=240,framerate=30/1 ! matroskamux ! filesink location=videotest.mkv
Any suggestions for a setting that is compatible between new and old gstreamer?
On *nix platforms, QtMultimedia uses GStreamer as its backend. On GStreamer's website it appears that JPEG is a supported format (and one would assume that includes motion jpeg.)
Check your package manager to make sure you have all of GStreamer's plugins installed. There's at least three different packages of GStreamer plugins on Ubuntu.
So I fixed it by using an avi container instead of a matroska container. No idea why it works now and not with matroska. I can honestly only think this has to be a bug somewhere.
I'm trying to embed this stream in to an HTML5 audio tag to be targeted at iOS mobile safari users: http://cjzn.streamon.fm/listen.m3u
After searching around I discovered that you can't embed M3U files directly with an HTML5 audio tag. So I saved that M3U file and opened it up, and it's only contents were:
http://cjzn.streamon.fm:8000/CJZN-48k.aac?starttime=1372879409
My next logical step was to try and embed that AAC file in to the audio tag, like so:
<audio src="http://cjzn.streamon.fm:8000/CJZN-48k.aac", autoplay="true"></audio>
But I still can't seem to get it working. Can anyone help me out?
As well, taking a step back to the M3U file - would it be smarter to try and use an M3U parser and convert the file in to a playlist that an audio player like jPlayer could play? What's the best option for me here? All I want to do is embed this stream in to my mobile Safari app.
At the moment AAC+ giving headache when it comes to Flash and HTML5. But actually you can link your M3U file from your Safari web app.
Steps -
Just create M3U file and upload it to your web server.
Then put a HTML link to that M3U file.
Example : <a href="playlist.m3u'>Play Stream</a>
All Apple devices will play that stream. I checked mine with Ipad, Iphone and Ipod touch.
I hope this will help you. Good luck !