Thanks Andrew. I am novice to the area of media formats and streaming. Your explanation really helps. :)
So as I understand, currently it is not possible to stream 3GP or mpeg4 formats over HTTP because of the reasons you have already mentioned. But I have some more questions now 1) Is it possible to stream the content over RTSP/ RTP / UDP? I will need to investigate whether it is possible to render RTSP/ RTP / UDP on Android. 2) You mentioned, The best solution to this just now is to pre-convert any videos into 3gp format and then stream them directly. But I do not understand what you say :( I am able to convert my content to .mp4 that plays on Android. But when I try to stream the mp4 file over HTTP using ffmpeg and ffserver, I get the errors mentioned earlier. Also in the commands mentioned below I am using "747.3gp" to try streaming over HTTP and I get errors. But the same file plays on my machine and also on Android when I use "http://daily3gp.com/vids/747.3gp" on the player. So I suspected that something is wrong with the configuration. Regards, Yadnesh On Fri, Jul 2, 2010 at 1:26 PM, Andrew Rowley < [email protected]> wrote: > > > > -----Original Message----- > > From: [email protected] [mailto:libav-user- > > [email protected]] On Behalf Of Yadnesh Phadke > > Sent: 02 July 2010 07:27 > > To: [email protected] > > Subject: [libav-user] Stream 3GP format over HTTP > > > > Hi All, > > > > I have asked the same question on the ffmpeg_user mailing list, but I > > am > > asking here too as I have no solution as yet > > > > > > > > I want to stream media files from my Ubuntu Linux 8.04 and play the > > stream > > on my Android. Initially, I am trying to stream media from a file over > > HTTP > > in 3GP format using ffserver and ffmpeg and play the stream on the same > > machine using ffplay > > > > When I use ffplay I see the following: > > *http://127.0.0.1:8090/test1.3gp: Invalid data found when processing > > input* > > > > and ffserver shows following error when I execute ffplay: > > ======================================================================= > > == > > ./ffserver -f 3gp_conf1 > > FFserver version 0.6, Copyright (c) 2000-2010 the FFmpeg developers > > built on Jul 1 2010 14:57:41 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4) > > configuration: > > libavutil 50.15. 1 / 50.15. 1 > > libavcodec 52.72. 2 / 52.72. 2 > > libavformat 52.64. 2 / 52.64. 2 > > libavdevice 52. 2. 0 / 52. 2. 0 > > libswscale 0.11. 0 / 0.11. 0 > > Thu Jul 1 17:37:28 2010 FFserver started. > > Thu Jul 1 17:37:44 2010 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 > > 8245 > > Thu Jul 1 17:37:48 2010 *Codec for stream 0 does not use global > > headers but > > container format requires global headers* > > Thu Jul 1 17:37:48 2010 *Codec for stream 1 does not use global > > headers but > > container format requires global headers* > > Thu Jul 1 17:37:48 2010 *muxer does not support non seekable output* > > Thu Jul 1 17:37:48 2010 *Error writing output header* > > Thu Jul 1 17:37:48 2010 127.0.0.1 - - [GET] "/test1.3gp HTTP/1.1" 200 > > 79 > > Thu Jul 1 17:37:48 2010 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 > > 389120 > > ======================================================================= > > == > > * > > * > > I see* similar error* when I try to *stream mp4* format. But when I > > choose > > format (in ffserver config) as *mpeg, **no error* is seen and ffplay > > shows > > the A/V. But I finally want to view the video on Android and it does > > not > > support mpeg file format. So I need to stream in either mp4 or 3gp > > format. > > I have tried using 2/3 different media files (.mp4, .3gp, .ts) for > > input > > and land into same error. > > I can create mp4/3gp files using ffmpeg and I am able to play these > > files on > > my Android mobile. But I do not want to copy all the content, I want > > to > > stream from my Ubuntu box and view on Android. > > > > For adding global headers, Are there any specific flags that I need to > > use > > with ffmpeg? is there anything extra needed in ffserver configuration > > to do > > 3GP streaming? > > > > I have done much google search and also tried some ffmpeg options that > > I > > thought to be possible solutions, but with no luck. Now I need expert > > opinion :) Please flood in your thoughts. > > > > *ffmpeg command* > > * > > ======================================================================= > > == > > ./ffmpeg -i ../../Media/747.3gp -acodec aac -vcodec mpeg4 -sameq - > > vglobal 2 > > http://127.0.0.1:8090/feed1.ffm > > FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers > > built on Jul 1 2010 14:57:41 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4) > > configuration: > > libavutil 50.15. 1 / 50.15. 1 > > libavcodec 52.72. 2 / 52.72. 2 > > libavformat 52.64. 2 / 52.64. 2 > > libavdevice 52. 2. 0 / 52. 2. 0 > > libswscale 0.11. 0 / 0.11. 0 > > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../../Media/747.3gp': > > Metadata: > > major_brand : 3gp4 > > minor_version : 512 > > compatible_brands: 3gp4 > > encoder : avc2.0.11.1110 > > encoder-jpn : avc2.0.11.1110 > > Duration: 00:00:31.20, start: 0.000000, bitrate: 136 kb/s > > Stream #0.0(eng): Video: mpeg4, yuv420p, 160x128 [PAR 1:1 DAR 5:4], > > 120 > > kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc > > Stream #0.1(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s > > Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm': > > Metadata: > > encoder : Lavf52.64.2 > > Stream #0.0(eng): Audio: aac, 44100 Hz, 1 channels, s16, 8 kb/s > > Stream #0.1(eng): Video: mpeg4, yuv420p, 192x144, q=2-31, 64 kb/s, > > 1000k > > tbn, 5 tbc > > Stream mapping: > > Stream #0.1 -> #0.0 > > Stream #0.0 -> #0.1 > > Press [q] to stop encoding > > Warning, using s16 intermediate sample format for resampling > > [mpeg4 @ 0x8ae3f70]rc buffer underflow > > frame= 20 fps= 0 q=2.0 size= 52kB time=3.88 bitrate= > > 109.9kbits/s > > dup=0 > > frame= 38 fps= 37 q=2.4 size= 100kB time=7.57 bitrate= > > 108.2kbits/s > > dup=0 > > frame= 57 fps= 37 q=2.5 size= 140kB time=11.33 bitrate= > > 101.2kbits/s > > dup=0 > > frame= 75 fps= 37 q=2.5 size= 180kB time=14.98 bitrate= > > 98.5kbits/s > > dup=0 > > frame= 92 fps= 36 q=2.9 size= 216kB time=18.30 bitrate= > > 96.7kbits/s > > dup=0 > > frame= 107 fps= 35 q=4.9 size= 256kB time=21.40 bitrate= > > 98.0kbits/s > > dup=0 > > frame= 123 fps= 35 q=3.2 size= 300kB time=24.59 bitrate= > > 99.9kbits/s > > dup=0 > > frame= 140 fps= 35 q=3.7 size= 332kB time=27.89 bitrate= > > 97.5kbits/s > > dup=0 > > frame= 154 fps= 34 q=3.6 size= 364kB time=30.79 bitrate= > > 96.8kbits/s > > dup=0 > > frame= 157 fps= 34 q=3.4 Lsize= 380kB time=31.21 bitrate= > > 99.8kbits/s > > dup=0 drop=622 > > video:311kB audio:37kB global headers:0kB muxing overhead 9.150682% > > ======================================================================= > > == > > * > > * > > * > > * > > > > If I execute same ffmpeg command again without restarting ffserver I > > see > > following error. Is this expected? > > ======================================================================= > > == > > ./ffmpeg -i ../../Media/747.3gp -acodec aac -vcodec mpeg4 -sameq - > > vglobal 2 > > http://127.0.0.1:8090/feed1.ffm > > FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers > > built on Jul 1 2010 14:57:41 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4) > > configuration: > > libavutil 50.15. 1 / 50.15. 1 > > libavcodec 52.72. 2 / 52.72. 2 > > libavformat 52.64. 2 / 52.64. 2 > > libavdevice 52. 2. 0 / 52. 2. 0 > > libswscale 0.11. 0 / 0.11. 0 > > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../../Media/747.3gp': > > Metadata: > > major_brand : 3gp4 > > minor_version : 512 > > compatible_brands: 3gp4 > > encoder : avc2.0.11.1110 > > encoder-jpn : avc2.0.11.1110 > > Duration: 00:00:31.20, start: 0.000000, bitrate: 136 kb/s > > Stream #0.0(eng): Video: mpeg4, yuv420p, 160x128 [PAR 1:1 DAR 5:4], > > 120 > > kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc > > Stream #0.1(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s > > [mpeg4 @ 0x8ae3f70]Error parsing rc_eq "comment": undefined constant or > > missing ( > > Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm': > > Stream #0.0(eng): Audio: aac, 44100 Hz, 1 channels, s16, 8 kb/s > > Stream #0.1(eng): Video: mpeg4, yuv420p, 192x144, q=2-31, 64 kb/s, > > 1000k > > tbn, 5 tbc > > Stream mapping: > > Stream #0.1 -> #0.0 > > Stream #0.0 -> #0.1 > > Error while opening encoder for output stream #0.1 - maybe incorrect > > parameters such as bit_rate, rate, width or height > > ======================================================================= > > == > > * > > * > > > > * > > * > > * > > *ffserver config*: > > ======================================================================= > > == > > Port 8090 > > BindAddress 0.0.0.0 > > MaxHTTPConnections 20 > > MaxClients 10 > > MaxBandwidth 100000 > > CustomLog - > > NoDaemon > > ################################################################## > > <Feed feed1.ffm> > > File /tmp/feed1.ffm > > FileMaxSize 2M > > ACL allow 127.0.0.1 > > </Feed> > > > > ################################################################## > > <Stream test1.3gp> > > Feed feed1.ffm > > Format 3gp > > AudioBitRate 8 > > AudioChannels 1 > > AudioSampleRate 44100 > > VideoBitRate 64 > > VideoBufferSize 20 > > VideoFrameRate 5 > > VideoSize 192x144 > > AudioCodec aac > > VideoCodec mpeg4 > > Preroll 15 > > </Stream> > > > > ################################################################## > > # Server status > > <Stream stat.html> > > Format status > > ACL allow 127.0.0.1 > > </Stream> > > > > # Redirect index.html to the appropriate site > > <Redirect index.html> > > ======================================================================= > > == > > > > > > -- > > Regards, > > Yadnesh > > ---------------------------------------------------------------------- > > Christopher Morley - There is only one success - to be able to spend > > your > > life in your own way. > > _______________________________________________ > > libav-user mailing list > > [email protected] > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > Hi, > > I happen to have been looking into this issue too. The 3gp and mpeg4 > formats are based on the Quicktime mov format. This format works by having > several sections in the file with tags, with each tag needing to specify the > size of the tag at the start. One of these tags is the size of all the data > in the file, which is not known in advance of encoding (only a worst guess > can be made based on the bitrate and bitrate tolerance). Unlike ASF format, > for example, these formats must have the size element specified, or else > they won't work. So libavformat must first write the data to a file, and > then go back and fill in the size of the elements, which it obviously can't > do with an http stream (since the data will be at the client by the time it > needs to go back and fill it in). > > The best solution to this just now is to pre-convert any videos into 3gp > format and then stream them directly. A future solution (which I am looking > at a bit) is to take the worst guess of the data size and then fill in any > space not used with some sort of padding. This will result in files that > are always a bit too big, but will at least allow the streaming of the data. > > In the long long run, someone should come up with a better file format for > streaming that can be indexed that doesn't need to know the size of the data > in advance (flv could actually be quite good at this as it is searchable > from the end as well as the start, meaning that you could add a key-frame > index to the end of the file after streaming it - unfortunately, most > standard media players can't play flv and others wouldn't know to look at > the end of the file for the index). > > Andrew :) > > --------------------------------------------------------- > > Andrew G D Rowley > Senior Development Officer > > Research Computing Services > The University of Manchester > Devonshire House, Oxford Road > Manchester, M13 9PL > > t : +44 (0) 161 275 0685 > e : [email protected] > w : www.manchester.ac.uk/researchcomputing > > --------------------------------------------------------- > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > -- ---------------------------------------------------------------------- Christopher Morley - There is only one success - to be able to spend your life in your own way. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
