Wrong duration HTML5 audio on mobile browsers, works fine on regular browsers (m4a file) - html

I am using Savedeo APIs to get to youtube audio files and trying to play the audio on a browser.
When I try to play an audio only file (.m4a) on regular browser, everything works fine. But, when I test it on a mobile browser on my iphone (safari and chrome), the audio file's duration is doubled. Basically after the end of the audio, there is a padding added.
Why is this happening? Is there any work around for this. If you need more info, will be happy to provide.
Thanks

I ran into this issue with a MP3 with a sample rate of 44100 Hz and a 128kb bitrate. The solution is to change the sample rate with ffmpeg:
ffmpeg -i your.mp3 -ar 22050 your_fixed.mp3
You can retrieve critical information about an MP3 by using ffprobe:
ffprobe your.mp3
iTunes also reports the wrong duration when calculating the duration with the actual MP3 file. That's embarrassing since you would expect iTunes to get something like that correct. This indicates a bug exists in some library that Apple uses for MP3 duration calculations.

Related

HTML5 video streaming issue

I know this kind of problem was already mentioned, but, I have to play some videos who are encoded in MP4 (h264 / AAC). Some of them are 2 hours long, sometimes more.
The problem is that they don't start quickly, because I need to download a random amount of data to be able to play the video : the browser doesn't load the entire file, but 5/6MB, which is a problem for the lowest connexions.
I tried the FFMpeg option -movflags +faststart but it changes nothing.
I tried the qt-faststart tool, it says "last atom in file was not a moov atom".
The server seems to be configurated to allow partial requests (Accept-Ranges:bytes in Response Headers).
Did I tried everything? Is there something more I can do?
Thanks !
Romain
You need to look into adaptive streaming. Either HLS or DASH format would solve your problem. It does entail to review your media delivery architecture and your video player.
Example here: https://www.keycdn.com/support/how-to-convert-mp4-to-hls/
Players like JW Player can read both format on most platforms.

html5 video safari downloads full before playing

Im wondering why my mp4 html5 video is not "streaming" and instead waits till it is fully downloaded before it starts playing in safari.
www.pija.se
I have tried QTIndexSwapper but it says the index is in the right position.
Any help appreciated.
looks like the MOOV atom isn't at the beginning of the file.
I used ffmpeg to just relocate that (no other encoding) and then a binary compare (using HexFiend) and a quick test seemed to show that Safari was playing the video sooner
./ffmpeg -i top.mp4 -codec copy -movflags faststart top-fs.mp4
(caveat being that even though I cleared browser cache I didn't do things like bounce my test server or time things too accurately)
FWIW I find ffmpeg to be a good solution, and especially for background video you'll want to play around with parameters to optimize for your use-case

.mp4 file not playing in chrome

I want to show a video on my website. I have created a .mp4 file and using the HTML5 video tag to add it to the html.
The problem is that it is not being displayed in chrome. I would also like to know how I can replay it again and again.
I too had the same issue. I changed the codec to H264-MPEG-4 AVC and the videos started working in HTML5/Chrome.
Option selected in converter: H264-MPEG-4 AVC, Codec visible in VLC player: H264-MPEG-4 AVC (part 10) (avc1)
Hope it helps...
After running into the same issue - here're some of my thoughts:
due to Chrome removing support for h264, on some machines, mp4 videos
encoded with it will either not work (throwing an Parser error when
viewing under Firebug/Network tab - consistent with issue submitted
here), or crash the browser, depending upon the encoding settings
it isn't consistent - it entirely depends upon the codecs installed
on the computer - while I didn't encounter this issue on my machine,
we did have one in the office where the issue occurred (and thus we
used this one for testing)
it might to do with Quicktime / divX settings (the machine in
question had an older version of Quicktime than my native one - we
didn't want to loose our testing pc though, so we didn't update it).
As it affects only Chrome (other browsers work fine with VideoForEverybody solution) the solution I've used is:
for every mp4 file, create a Theora encoded mp4 file (example.mp4 -> example_c.mp4)
apply following js:
if (window.chrome)
$("[type=video\\\/mp4]").each(function()
{
$(this).attr('src', $(this).attr('src').replace(".mp4", "_c.mp4"));
});
Unfortunately it's a bad Chrome hack, but hey, at least it works.
Source: user: eithedog
This also can help: chrome could play html5 mp4 video but html5test said chrome did not support mp4 video codec
Also check your version of crome here: html5test
(#Alston posted this as a comment, and it worked for me, and 9 others who also upvoted, so posting this as an answer to get more eyeballs on it:)
Simply re-encoding the video file with this FFMPEG command solves it:
ffmpeg -i input.mp4 -vcodec h264 output.mp4
This started out as an attempt to cast video from my pc to a tv (with subtitles) eventually using Chromecast. And I ended up in this "does not play mp4" situation. However I seemed to have proved that Chrome will play (exactly the same) mp4 as long as it isn't wrapped in html(5)
So here is what I have constructed. I have made a webpage under localhost and in there is a default.htm which contains:-
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<video controls >
<source src="sample.mp4" type="video/mp4">
<track kind="subtitles" src="sample.vtt" label="gcsubs" srclang="eng">
</video>
</body>
</html>
the video and subtitle files are stored in the same folder as default.htm
I have the very latest version of Chrome (just updated this morning)
When I type the appropriate localhost... into my Chrome browser a black square appears with a "GO" arrow and an elapsed time bar, a mute button and an icon which says "CC". If I hit the go arrow, nothing happens (it doesn't change to "pause", the elapsed time doesn't move, and the timer sticks at 0:00. There are no error messages - nothing!
(note that if I input localhost.. to IE11 the video plays!!!!
In Chrome if I enter the disc address of sample.mp4 (i.e. C:\webstore\sample.mp4 then Chrome will play the video fine?.
This last bit is probably a working solution for Chromecast except that I cannot see any subtitles. I really want a solution with working subtitles.
I just don't understand what is different in Chrome between the two methods of playing mp4
Encountering the same problem, I solved this by reconverting the file with default mp4 settings in iMovie.
I was actually running into some strange errors with mp4's a while ago. What fixed it for me was re-encoding the video using known supported codecs (H.264 & MP3).
I actually used the VLC player to do so and it worked fine afterward. I converted using the mentioned codecs H.264/MP3. That solved it for me.
Maybe the problem is not in the format but in the JavaScript implementation of the play/ pause methods. May I suggest visiting the following link where Google developer explains it in a good way?
Additionally, you could choose to use the newer webp format, which Chrome supports out of the box, but be careful with other browsers. Check the support for it before implementation. Here's a link that describes the mentioned format.
On that note: I've created a small script that easily converts all standard formats to webp. You can easily configure it to fit your needs. Here's the Github repo of the same projects.

Node-Webkit: How to play AVI videos?

I am trying to make a simple node-webkit app that lets you play .avi videos (which should work both on windows and mac). Is there a way to do this with node-webkit?
It is unlikely you will be able to just do this with Node-Webkit. Especially since the official webkit does not support AVI. Your best bet is to use an external application like libav (avplay) or use node to serve a webpage that has a player capable of playing the content and just let the users browser do the work. (Flash is likely still the best way to go, video.js is a good choice)
The alternative is to convert the video to one of the supported formats. I would recommend mp4. (Once again libav (avconv) comes in handy here.) This still assumes that Node-Webkit has implemented full HTML5 support. (I am not sure what they have completed but I am guessing it supports the video element)
Is AVI supported in Chrome (not Chromium) ?
If it is you have to change the libffmpegsumo.so in nw for the one in Chrome (try to use the same version).
libffmpegsumo.so is called ffmpegsumo.dll in Windows
The file file is in the same folder of the nw executable
to get the file download google chrome and go to %USER%/Google Chrome/ (or something like that) and you'll find the file in the same folder of the google-chrome executable
You can wcjs-player to play any format video which supported by VLC. It plays any video without any lags as in-built player.
To support my above claim, I have following points:
Building NW (by compiling source code) with various FFMPEG codec flags given at nw github site, doesn't help, in getting ffmpegsumo.dll which can play avi file format.
wcjs-player uses VLC libraries, which support all video played by VLC does.
Its better than using any nw plugin, as internally wcjs-player using VLC does similar job as HTML native video support .
Even if you suceed playing avi files, sometimes supported videos file format may not get played like most ironically mp4 file itself.
Apart from this, Teewe Theatre, Popcorn Time , Butter are among NW based media player using wcjs-player. It hardly increased 30 MB size of overall app size.

Play video chunks in googletv with chrome

I am currently working on a web application for video processing. Here is the situation:
I have a mp4 h264 video as input, I split the video in multiple avi files. Each avi file is processed individually generating another avi file as an output which is immediately encoded back to h264 and is now ready to be displayed in my web application.
The problem is that in need to play those video chunks as if they were a single video but I have not been able to accomplish that in a proper way. I have tried the following solutions without having the expected results:
JW Player: Each time a chunk is played, the player goes black and as far as I know it is not plausible to pause it on the last frame
Flowplayer: Videos wont reproduce on googletv's chrome browser
HTML5 video tag: Behaves extrangely on googletv's chrome browser not playing the chunks completely when the src attribute changes and no playing at all less-than-1-second-chunks (It works fine on linux)
Any Ideas?