QMediaPlayer - length of video - qt

I have coded two versions of video player based on QMediaPlayer and on Vlc-qt. In both cases I have the incorrect value for the full time video. The player show me that total time is 7 seconds, but in fact the time approx. 5 minutes. And of course, the slider of position shows not correct.
I was confused, so that maybe I did something wrong. But this video file was tested with MS video player, and I see the same problem.
Video for testing can be found at https://1drv.ms/u/s!AgCzZ90Ttbz65jqiluS2NS95Id0U
My guess is that the file contains the wrong information about the time. Or maybe not codec provides such information in not correct way.
Can anybody clarify to me what the reason of the problem and how it should be fixed.

Related

How to stop flutter video player from buffering when video reaches a certain percentaje?

I'm using the video_player plugin in flutter combined with Firebase and I just realized that a video could consume my whole Firebase bandwith If I let it play for a few seconds. So I think (correct me if I'm wrong please!) that the best idea is to stop buffering when it reaches a certain amount, for example the 5% of the video or the first 5 seconds of the video, but if someone has a super fast download speed they can get the whole video in the first 3 seconds, so that would consume the limit no matter what.
Is there a way to do this? To know when the amount buffered is enough to play like 5 seconds and then stop the buffering? Maybe with another plugin?
EDIT 1: Or does video_player just streams data as it comes, not prebuffering? if this is the case then with just closing the video player is enough to limit the amount of data retrieved, right?
Thanks in advance for any idea about this!

FLV video shows wrong playhead time

I am recording FLV videos with Red5 server and playing them back in a Flex app. I am aware that Red5 does not properly inject the FLV MetaData, so I am using an external commandline tool to get the metadata in there.
Because I am injecting the metadata, my duration of the video is correct.
The problem I am having, and this is true with all FLV players I try to play the video with (even 3rd party stand-alone video players), is the PlayHead time is never started at 0. When I load up the FLV to play and lets say the video is 10 seconds long, the current time label on the playhead starts at 1-2seconds instead of 0 and the horizontal slider current time indicator also is moved away from 0 and is set to 1-2 seconds along the slidebar. the video plays back fine from what I can see though.
Is there a byte in the FLV that I need to change so that it will start the playhead at 0? I realize this is probably something to do with Red5, so if anyone has any work-arounds or potential things to watch out for that may be causing this, I would really appreciate it!
Just to update this in case someone else encounters this, it turned out that the version of Red5 I was using (0.9 I believe) was the issue. I upgraded to 1.0RC1 and immediately the video timeline was corrected to 0.00 - 10.00 (assuming it was a 10 second video).
I was afraid to upgrade to 1.0RC1 because I feared the java app I created would encounter issues with the upgrade since I developed it on an earlier version and read so many posts about things not working with upgrading.. but I guess I got lucky, it works perfectly!

AVAudioPlayer : Short sound does not play randomly

I am using AVAudioPlayer.
I have a short sound in my application.
Randomly it does not play , Play API does not return any error,
Volume is also proper that moment. I am not getting what is going wrong.
Interesting thing is If I play some other sound file, It does play properly every time.
Then I did check properties of both the sound files.
The both the sound files have same bit rate, only difference is
The one which does not play randomly has 00.02 duration.
and the one which play properly has 00.00 duration.
Can anybody give me idea to fix this issue?.

How to split movie and play parts to look as a whole?

I'm writing software which is demonstraiting video on demand service. One of the feature is something similiar to IIS Smooth Streaming - I want to adjust quality to the bandwith of the client. My idea is, to split single movie into many, let's say - 2 seconds parts, in different qualities and then send it to the client and play them. The point is that for example first part can be in very high quality, and second in really poor (if the bandwith seems to be poor). The question is - do you know any software that allows me to cut movies precisly? For example ffmpeg splits movies in a way that join is visible and really annoying (seconds are the measure of precision). I use qt + phonon as a player if it matters. Or maybe you know any better way to provide such feature, without splitting movie into parts?
Are you sure ffmpeg's precision is in seconds? Here's an excerpt from the man page:
-t duration
Restrict the transcoded/captured video sequence to the duration specified in seconds. "hh:mm:ss[.xxx]" syntax is also supported.
-ss position
Seek to given time position in seconds. "hh:mm:ss[.xxx]" syntax is also supported.
-itsoffset offset
Set the input time offset in seconds. "[-]hh:mm:ss[.xxx]" syntax is also supported. This option affects all the input files that follow it. The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by 'offset' seconds.
Looks like it supports up to millisecond precision, and since most video is not +1000 frames per second, this would be more than enough precision to accurately seek through any video stream.
Are you sure this is a good idea? Checking the bandwidth and switching out clips every two seconds seems like it will only allow you to buffer two seconds into the future at any given point, and unless the client has some Godly connection, it will appear extremely jumpy.
And what about playback, if the user replays the video? Would it recalculate the quality as it replays, or do you build the video file while streaming?
I am not experienced in the field of streaming video, but it seems what I see most often is that the provider has several different quality versions of their video (from extremely low to HD), and they test the user's bandwidth and then stream at an appropriate quality.
(I apologize if I misunderstood the question.)

Get mp3 total track time using either javascript or ASP.NET

I am using the below jQuery plugin for playing mp3
www.happyworm.com/jquery/jplayer
However, there is a bug in Flash that the total play (track) time won't show up correctly UNTIL AFTER the whole mp3 is completed downloaded.
I wonder if there is a way to work around this to get the correct total time using either javascript / another flash / even backend library in ASP.NET. Any suggestion helps. Thanks
You sure that's a bug? Looking at the header definition for the MP3 format I don't see any values for the length of the file. Generally applications that play MP3s would have to calculate the time, and that may not be doable until the entire file is downloaded. So the behavior you're seeing from Flash might be expected.
Theoretically if it's a fixed bitrate file (as opposed to VBR) then knowing the bitrate (gotten from the header) and the total size of the file should be enough to calculate it. However, the server would have to report the size of the file in the response headers (and that's not guaranteed to be accurate).
My guess is you'd need some service on the server that could calculate the length and report that to you in a separate request.

Resources