While streaming video through live555 upon changing encoder resolution by 1 or 2 pixels the decoder not changes the resolution until refreshed - h.264

I am working on an IP camera. I know that H.264 encoder requires video resolution in multiple of 2 to work. Whenever I set a resolution on encoder lets say 1280x720 while live streaming is going on the decoder dynamically displays me the updated value. The problem here is that when I try to set the width just one scale lower say 1276x720 then it is correctly set on encoder but the decoder does not displays the change is width until I refresh the webpage or in case of vlc until I stop and start the streaming again. I have verified the same on vlc also. If I set to lower resolution by more than just few pixels like 1272x720 then both my webbrowser and vlc updates the value dynamically.
I have also cross verified it with H.265 codec but it doesn't seem to be the problem on that.
Anyone has the idea what might be the reason for that because the values are updated even though only the stream has been stopped and start again and nothing changes in between.

H.264 needs 16x16 alignment. For example 1920 x 1080 is actually encoded as 1920 x 1088.
The pixel accurate resolution is achieved by using the the frame_crop_* values in the sequence parameter set. Now - I can only guess that the decoder (your website or VLC) doesn't dynamically evaluate the frame_crop_* values.

Related

How do I stream a video of initially unknown size to the HTML5 video tag?

I am attempting to write a web service (using C# and WebAPI, thought the actual server technology likely isn't important) that hosts dynamic video files for consumption by a basic HTML5 video element.
Here is my situation and my requirements:
The video is being transcoded on the fly and so the final file size is not known. I cannot provide a Content-Length. However, the time duration of the video is known in advance.
The video must be immediately playable when the page loads, even if it's not done transcoding.
The user must be able, via the HTML5 video controls, to seek backwards and forwards in the video. If they attempt to seek forward to a point that is not transcoded, the request will block until the transcoding catches up.
I tried to use a 206: Partial Content response with the Content-Range header but since I am unable to provide a content-length, the player in Chrome seems unable to seek beyond the first chunk of video it gets and the player in Firefox doesn't even attempt to download more than the first chunk. It is also invalid to respond with a range outside what is asked for by the client but the video player always asks for bytes 0+.
Without a content-length, I considered using Transfer-Encoding: chunked and chunking the output. However, Chrome does not let you seek through a video if the server does not support ranged requests.
I have also considered specifying a fake content length of 1TB or something ridiculous just so I can do the ranged response option but I do not know if that will affect the progress bar or seek capabilities. Does the HTML5 video player determine the progress bar's dimensions based on file size or duration?
So what are my options? I am sure this is a problem that's been solved before. Can ranged responses be used in conjunction with chunked encoding?

H264 over RTP - Blurred Section of Video

I've got an packetizer which is taking NAL units from an H264 stream and sending them out over RTP using UDP.
Everything works, but the top ~15% of the resulting video when viewed in VLC or FFPlay is blurred (screenshot linked below).
The stream uses FU-A but this matches the spec in RFC6184.
If I save the nal units to a file before the packetization it plays perfectly without the blur.
I've spent quite a while trying to work out what's going wrong with it and have run out of ideas, so was hoping someone here might have some pointers to help me out?
Any help very much appreciated.
Blur at top of screen

How can I zoom into video and switch streaming of videos in the same HTML5 player?

I have video that will be divided into 4 videos.
First the player will stream a lower resolution of the original video, then the user can zoom into the video to see more details, I need the player to stream one of the 4 videos - that's higher in resolution- based on where the user zoomed in.
How can I make that using VideoJS or any other video player ?
After searching, this is the answer ...
For zooming into the video, you can follow this tutorial: Zooming and rotating for video in HTML5 and CSS3
For switch streaming of videos in the same player, you can make that by changing the source on html5 video tag and make some calculations to know where the user zoomed in and hence change the source video.
As there is no response yet let me analyse the problem. This is by no means meant as a full answer, but other people will probably be able to answer parts of the problem:
First the player will stream a lower resolution of the original video,
This means you will need to create/use a video stream. There are plenty of plugins you can use for videostreaming, and depends on what you want. You can consider writing it yourself using for example C#'s System.IO objects and transforming the video in bytes(And putting it back together) The resolution would be easiest reached by just having a seperate video file for this step of the proces. (a lower resolution one used for streaming only)
then the user can zoom into the video to see more details, I need the player to stream one of the 4 videos - that's higher in resolution- based on where the user zoomed in.
So you need to trigger a zoom effect. This means you would need to detect zoom. This would be possible with Javascript in a webbrowser, if you want a browser based application. When that zoom is triggered you can retrieve what position the mouse is on the screen/in the div or on some sort of overlay. Depending on this position you could show another stream.
How can I make that using VideoJS or any other video player ?
Basically these steps above is how i would start looking into this specific case. Considering your VideoJS as a suggestion i assume this is browser based. This would probably mean using Javascript libraries, maybe combined with a server side language.
Thats as far as i can go. Maybe someone can pick up specific parts of the thing i wrote and help you a step further.
Have a nice day!

IE9 decode error on HTML5 video of mp4 file

I write a html5 page, the source is as fllows:
<!doctype html5>
....
<video id="vdemo1" controls width="440" height="248">
<source src='http://mysite.com/demo.webm' type='video/webm'>
<source src='http://mysite.com/demo.mp4' type='video/mp4'>
// fallback codes
</video>
the output of video tag is an empty black box. By following the instruction on this url:HTML5 Video not working in IE9 - Some tips to debug, it shows a MEDIA_ERR_DECODE error code. However, I can right click on the empty viewport and choose 'play' item but nothing appears in viewport. After right clck and choose 'save' to save mp4 file to local hd, it can be played well under OS. I even change video src to local file but it doesn't help!
Does IE9 lose the mp4 codec ability ( I'm sure the mp4 is encoded in H.264)? How can I regain the ability?
=======
edit # 2012/10/9
There's a strange thing happened. I never run Windows media player before and after I run it 1st time, if source of video tag is local file, it can be playbacked. But if remote url, then it won't. Can anyone see why?
Re-sort the sources - put mp4 on top!
Check if your server sends the correct mime type (video/mp4) for your mp4.
Both can break playback...
Sometimes I've seen IE9 have trouble playing videos encoded with B-Frames. Try encoding your video without them. You can do this with ffmpeg by adding the option "-bf 0" to the command line.
In some cases, Internet Explorer throws a decode error (MEDIA_ERR_DECODE - An error has occurred in the decoding of the media resource, after the resource was established to be usable) and is unable to play videos with dimensions that are not evenly divisible by 16.
For example, it may perfectly play a video that is 960x400 ( 960 % 16 == 0 and 400 % 16 == 0 ), but when reducing the dimensions by half (480x200) it will not play ( 480 % 16 == 0 but 200 % 16 != 0 ).
One way to get around this is to enclose the re-sized video in an area with known good geometry, and then pad out the remaining area with black bars to avoid distorting the aspect ratio.
To do this, we used the following code adapted from a different SO answer that I can't seem to track down right now: -vf "scale=iw*min(640/iw\,480/ih):ih*min(640/iw\,480/ih),pad=640:480:(640-iw)/2:(480-ih)/2".

HTML5 Video Tag Width/Height

I'm trying to create a video tag for use with Chrome only. I don't always know the dimensions of the video, but I would like to have it be the size of the window. I thought I could accomplish this by using "width=100%" and "height=100%", but I found that the built-in controls were hard to see. I reduced height to 98%. Most of the videos I am currently trying to play are 720p MP4's. I tried playing a 1080p (actual dimensions being 1920x1040), and it wouldn't work (the video player acted as if my source was wrong, but I could right click and successfully download the file). The file size was more than 3 gig, I'm not sure if that had anything to do with it.
Edit: I also checked that the codecs were the exact same, and they are between the smaller and larger videos.
Anybody else having the same or like issues?
I just wanted to post on here now that I've fixed this issue. The issue was the file size information is apparently at the end of normal MP4's. For streaming, we want this information at the front of the file so the player can decide how to buffer and what-not. Chrome must do some sort of quick file size check if it doesn't find the file size information at the beginning. I used a program called QT-Faststart which moves the file size information to the front of the file. Thus solving the issue.