-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video streaming latency and some other streaming problems #149
Comments
|
set those 3 parameters: but I can test it now, because current android device has x86 architecture. I placed native libraries from JavaCV 0.11 to libs/armeabi and libs/x86 folders: ARM-device works correctly (as it was on 0.9 ver, with same unaccepatable playback latency), but on my x86 JVM throws exception: how I can fix it?
In sample config lists following supported formats:
I used avi because it seems to be used with MPEG-4 codec.. So which format is suitable for streaming in that case?
|
I changed format to "matroska" and now it's much more acceptable playback latency: 3-5 seconds with MPEG4 / libx264 / H263 codecs. Setted options not affect largerly on it. And after re-connecting from VLC, there are no "skipped frames" errors in log. With starting streaming I receive warning: "[matroska @ 0xa9dec8c]Codec for stream 0 does not use global headers but container format requires global headers", if using codec any of this codecs, but it doesn't really matter. |
And what happens if you use |
Any updates on this? Have you gotten everything running alright? |
Last time I tested this was 3 month ago. Video streaming worked fine enough with matroska format, but without sound recording and recorder could not be initialized with MJPEG codec. Now I don't work on this project anymore. Thanks for your help anyway. |
FYI, I've found the issue with MJPEG (#410). |
I'm using JavaCV library 0.9 and FFmpegFrameRecorder class and "ffm" format for streaming video from Android device to ffserver using given feed file. I have few problems and it could be great if you help me with it. And btw sorry for my english :)
In all cases I'm currently using "avi" format for tests in ffserver conf. And I monitor current settings and feed state via stat.html (as some settings will be overriden with recorder start() i will see it on this page).
so there are can't be 'redundant' frames to encode. The strange feature is the lower source fps (and consequently bitrate), than the more time needed to get an current frame in VLC (3 fps - almost one minute to wait!), during this time i got black screen or freezed first frame. And this time difference is staying during all streaming time.
For example, when hardware fps will be increased by camera.setRecorderHint(true) (between stopPreview() and startPreview() calls) to ~21, it takes only 20 seconds to wait in VLC.
I tried to start ffserver with different parameters in .conf file (like "FileMaxSize" (5M) in feed section or "VideoBufferSize" (5000), "VideoIntraOnly", "VideoGopSize" (12)), but result is almost the same.. Maybe I miss something, I don't know.
So, what is the possible reasons of playback latency? How I can fix it?
Wed May 13 15:57:44 2015 [avi @ 0xb35254c]Too large number of skipped frames 526349 > 60000
Wed May 13 15:57:44 2015 Error writing frame to output for stream 'test2.avi': Invalid argument
...
After restarting stream by FFmpegFrameRecorder these errors dissapper and VLC succesfully connects to this stream (with same unacceptable latency). So with every client connect to stream, I should send command to device to restart streaming.
Unfortunately, it can be reproduced also when VLC already connected to stream: image will be freezed.
What "Too large number of skipped frames" error means and is it FFmpegFrameRecorder fault?
H263. Same "too large number of skipped frames" problem reproduces, but a bit more latency (12 seconds vs 20 seconds with 20 fps and 480x320 (lower - a bigger latency)). Few times I got incorrect playback speed with followed by freezes, but now it seems to be ok. The very strange thing is when I set on recorder 480x320, on ffserver I see 704x576, if 320x240 - 352x288, so I see in VLC scaled image with proportions violation.
H264 (with option "preset", "ultrafast"). 176x144 frame, 20 fps. One time I succesfully connected from VLC to stream during few seconds and get image without any delays. But all following times I didn't get so lucky: 1 minute delay with 176x144 and 54 seconds with 480x320. Interesting moment is after .start() with this codec ffserver parameter "q" (quality) automatically changed to -1-1 (previous times with H263 and MPEG4 it was 2-31)
MJPEG. My colleague thinks that using that codec will solve problem. But when i set this codec (avcodec.AV_CODEC_ID_MJPEG) recorder throws exception (could not open codec). Is it any way to recompile your libraries with MJPEG support and is it a big sense to do that?
Periodically falls off preview frames (no onPreviewFrame() callbacks) between stopStreaming(), startStreaming(), when using setRecorderHint() option. It's android bug, just saying)
I did not succeeded with recording audio jointly with video frames: it throws sooner or later exception with "av_interleaved_write_frame() error" (don't remember error code). Caused by incorrect timestamps, I think. Tried to insert checks with "last used" timestamp, but it won't help.
Frequently throwed "fatal signal 11". But it's not a big problem, because it handles by my app.
And some related to the subject pieces of code.
private boolean isPreviewStated = false;
if (isFfmpegRecorderRecording && yuvIplImage != null && ffmpegRecorder != null && ffmpegRecorder.getVideoCodec() > 0) {
Thanks in advance!
The text was updated successfully, but these errors were encountered: