Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


FFServer & FFMpeg Android Screencast Tool

Discussions about problems encountered using ffserver.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

FFServer & FFMpeg Android Screencast Tool

Postby rconline » Wed May 30, 2012 6:50 pm

Hi All,

I am trying to build a screencast utility on Android with the following combination -

Architecture:

- Ffserver Stream for external client communication - format (rtp)
- The stream comes out of ffmpeg encoding which becomes the feed
- View the stream using mplayer or vlc through rtsp://host:port/stream.mp4

Status:

I have re-compiled ffserver and ffmpeg for the android-x86. I was able to stream static files, e.g: /data/1.mp4, which I had pushed to the android-x86 VM.

Problem:

I am unable to stream the framebuffer /dev/graphics/fb0 in the way that I am able to stream static files. Somehow ffmpeg refuses to understand that the fb0 is a continuously changing file which will produce a continuous stream.

Code:

Code: Select all
Sever config:

Port 8090
RTSPPort 7654
BindAddress 0.0.0.0
RTSPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
File /data/feed1.ffm
ACL allow 127.0.0.1
</Feed>
<Stream test1.mp4>
Feed feed1.ffm
Format mpeg1video
</Stream>


FFMpeg encoding commands used -

Does not work -

Code: Select all
./ffmpeg -r 30 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800X640 -i /dev/graphics/fb0 -vcodec mpeg4 http://localhost:7654/feed1.ffm

(The encoding stops immediately, and nothing is posted to the stream, although there is no error)

Works -

Code: Select all
./ffmpeg -r 30 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800X640 -i /dev/graphics/fb0 -vcodec mpeg4 a.mp4


(The encoding produces a file a.mp4 which can be viewed on a video player)

What also works :

Code: Select all
./ffmpeg -r 30 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800X640 -i /dev/video0 -vcodec mpeg4 http://localhost:7654/feed1.ffm


(This encoding gives me the video output even though of poor quality - which I plan to address once I can make some progress)

I have also tried options like fbdev etc, but without success.

I know that this questions doesn't exactly belong to the forum, but I haven't been able to get much help at the ffmpeg community/web. Any help will be much appreciated.

Please let me know whats the best place for this question and I will move it to the appropriate forum.

Thanks
RC
rconline@gmail.com
rconline
 
Posts: 5
Joined: Wed May 30, 2012 6:45 pm

Re: FFServer & FFMpeg Android Screencast Tool

Postby burek » Wed May 30, 2012 7:16 pm

can you try with "-f video4linux2 -i /dev/graphics/fb0" ?
burek
 
Posts: 867
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: FFServer & FFMpeg Android Screencast Tool

Postby rconline » Thu May 31, 2012 12:41 pm

Hi Burek,

Thanks for your reply.

I tried with v4le and here's the error that I get - ioctl(VIDIOC_QUERYCAP): Not a typewriter

I've also tried fbdev when I get : Framebuffer pixel format not supported.

Please let me know if you can think of anything else.

Thanks.
RC
rconline
 
Posts: 5
Joined: Wed May 30, 2012 6:45 pm

Re: FFServer & FFMpeg Android Screencast Tool

Postby burek » Thu May 31, 2012 1:21 pm

oh, I see now, your problem is not with input, but with ffserver..
the general usage of ffmpeg with ffserver is like this:
Code: Select all
ffmpeg <input options> -i input http://localhost:8090/feed1.ffm


now, you might ask yourself where is the "-vcodec" option, to specify your encoder and such things? well, when using ffserver (with ffm format), ffmpeg will first connect to ffserver and get feed1.ffm definition, to see what encoder(s) to use for the input, so you don't need "-vcodec" option because encoder(s) will be defined in ffserver.conf file.

try running your ffserver with config file like this:
Code: Select all
Port 8090
RTSPPort 7654
BindAddress 0.0.0.0
RTSPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
   File /data/feed1.ffm
   ACL allow 127.0.0.1
</Feed>
<Stream test1.flv>
   Feed feed1.ffm
   Format flv
   VideoCodec libx264
   AVOptionVideo flags +global_header
</Stream>

the reason to use flv instead of mp4 is that mp4 is not "streamable" (it can be, but you need a lot of workarounds to get it to work), meaning mp4 is a file format meant for file storage (on disks mostly) and not like mpegts or flv which are suitable for streaming too (because they keep some important data at the beginning and not at the end, like mp4).

and run your ffmpeg like this:
Code: Select all
./ffmpeg -r 30 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800X640 -i /dev/graphics/fb0 http://localhost:8090/feed1.ffm


after all that is started, you can access your stream at:
Code: Select all
http://<ip address>:8090/test1.flv
burek
 
Posts: 867
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: FFServer & FFMpeg Android Screencast Tool

Postby rconline » Fri Jun 01, 2012 6:32 pm

Hi Burek,

Thanks for your reply.

I have tried the Flv format you suggested for ffserver. Unfortunately, I had not cross-compiled ffmpeg with libx264. I am going to do that, and then reply back. As of now without the codec I am getting an error - Error while decoding stream #0:0. I am guessing I need to try it with the lix264.

If you think there's something else wrong, please let me know.

Thanks
RC
rconline
 
Posts: 5
Joined: Wed May 30, 2012 6:45 pm

Re: FFServer & FFMpeg Android Screencast Tool

Postby burek » Fri Jun 01, 2012 10:04 pm

well, to be honest, sooner or later you'll end up using libx264, because it's one of the best video encoders today :) so, focus your time on getting it done, so you can enjoy more later :)
burek
 
Posts: 867
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: FFServer & FFMpeg Android Screencast Tool

Postby rconline » Mon Jun 11, 2012 8:13 pm

Hi Burek,

Last time we spoke, I was just starting to get into libx264. I've run into some problems though. I was able to compile the libx264 without any issue on my Ubuntu 10.04. You will also remember that I have been trying to cross compile ffmpeg and libx264, with the android-ndk gcc so that it could run on my android-x86. Now there are two scenarios

Code: Select all
./configure --enable-static --enable-libx264 --enable-ffmpeg --enable-ffserver --disable-asm --enable-gpl --enable-version3 --enable-nonfree --disable-doc --disable-ffplay --disable-ffprobe --disable-avdevice --disable-avfilter --enable-small --target-os=linux --disable-debug --disable-stripping --enable-cross-compile --cross-prefix=/home/rohit/Downloads/android-ndk-r7b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux- --sysroot=/home/rohit/Downloads/android-ndk-r7b/platforms/android-9/arch-x86  --arch=x86



Results in an error - ERROR: libx264 not found. And I have tried it with cflags etc.

Now I sort of figured out that since I have cross-compiled the ffmpeg, I should cross compile the libx264 as well. Well, when I try to this, but

Code: Select all
./configure --cross-prefix=/home/rohit/Downloads/android-ndk-r7b/toolchains/x86-4.4.3/prebuilt/linux-x86/bin/i686-android-linux- --sysroot=/home/rohit/Downloads/android-ndk-r7b/platforms/android-9/arch-x86  --target-os=linux --arch=x86 ----enable-multilib --enable-targets=i686-pc-linux-gnu --enable-shared


This is the error that comes because of this.

conftest.c:1: sorry, unimplemented: 64-bit mode not compiled in
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main () { return 0; }
--------------------------------------------------
DIED: No working C compiler found.


Now, I am a little stuck here. Will help if you have any ideas.

Thanks & Regards
Rohit.
rconline
 
Posts: 5
Joined: Wed May 30, 2012 6:45 pm

Re: FFServer & FFMpeg Android Screencast Tool

Postby burek » Tue Jun 12, 2012 6:56 am

"libx264 not found" means you need to install libx264-dev or similar which is a development library (with headers) which you can include in any project (like ffmpeg) in contrast to libx264 which is binary only. Also, sometimes, when people compile libx264, they forget to do "ldconfig" so their compiler throws that error because it couldn't find the path for the compiled library.

I'm not familiar with later err message, so my suggestion is for you to ask on VideoLan's support irc channel, which is located here: irc://irc.freenode.net/videolan
burek
 
Posts: 867
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: FFServer & FFMpeg Android Screencast Tool

Postby rconline » Tue Jun 12, 2012 11:12 am

Thanks Burek for your reply. I had done ldconfig as well. The reason I felt that it was a cross compilation issue was because, the libx264 lib is identified when I am not cross compiling with the ndk, and in that case the ffmpeg package is built.

I will try at the vlc irc and will report back, if I get any help.

Thanks again.
RC.
rconline
 
Posts: 5
Joined: Wed May 30, 2012 6:45 pm

Re: FFServer & FFMpeg Android Screencast Tool

Postby caper35 » Wed Jul 30, 2014 8:14 am

As a developer, I had to involve in many projects and one of those kind is the developing a screen cast utility in the above-mentioned way. I also had the similar problem with the streaming of framebuffer and the recompilation does not work. The resolutions given here nothing works at all.

***********
caper35
caper35
 
Posts: 1
Joined: Wed Jul 30, 2014 4:29 am


Return to ffserver

Who is online

Users browsing this forum: No registered users and 3 guests