FLV streaming on Windows with 0.9.8a

About encoding, codec settings, muxers and filter usage
gdead
New Cone
New Cone
Posts: 2
Joined: 22 Jan 2009 06:23

FLV streaming on Windows with 0.9.8a

Postby gdead » 22 Jan 2009 06:31

Howdy,
I'm having a problem streaming FLV video using 0.9.8a. I'm attempting to do the following:

Code: Select all

VLC screen:// :screen-fps=5 --sout "#transcode{vcodec=FLV1,vb=400,scale=0.5,width=800,height=600}:standard{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=:8080/stream.flv}"
I've tried a wide variety of permuations of this command including removing the MIME definition, removing the scale, etc. It seems to start streaming (no errors in the logs except "avformat error: could not write header") but VLC on the other end can't view the stream. I can't get anything to see the stream. I can stream other types of video (mp4 via MPEG transport, etc), but FLV seems totally borked.

When I use the GUI to try the same thing, I get an error regarding the lack of matching mux modules:

Code: Select all

main info: creating httpd main error: no sout mux module matched "flv" stream_out_standard error: no suitable sout mux module for `http/flv://192.168.1.8:8080' stream_out_duplicate error: no destination given stream_out_transcode error: cannot create chain main error: stream chain failed for `transcode{vcodec=h264,vb=800,scale=0.25}:duplicate{dst=std{access=http,mux=flv,dst=192.168.1.8:8080}}' main error: cannot start stream output instance, aborting
Any suggestions on what I'm doing wrong? From what I can tell this as worked for others in the past so I'm not sure what's up.

Thanks for any help.

trok
Blank Cone
Blank Cone
Posts: 70
Joined: 09 Jun 2008 22:36

Re: FLV streaming on Windows with 0.9.8a

Postby trok » 22 Jan 2009 23:18

Is it working on an other version ?

gdead
New Cone
New Cone
Posts: 2
Joined: 22 Jan 2009 06:23

Re: FLV streaming on Windows with 0.9.8a

Postby gdead » 22 Jan 2009 23:57

Not that I know of. I had an older version (0.8.something) installed when I started all this and steaming FLV didn't work with that version. So I upgraded to the latest and am stuck at this point.

I should say, however, there is evidence of this working elsewhere on the forums with a variety of relatively recent 0.9.x versions. I haven't found anything that is exactly the same as my situation (Vista with screen:// with 0.9.8) however.

Squirrelywrath
New Cone
New Cone
Posts: 9
Joined: 09 Apr 2007 22:50

Re: FLV streaming on Windows with 0.9.8a

Postby Squirrelywrath » 30 Jan 2009 20:28

I had it working on Fedora 10 running 0.9.8a. Try changing the mux to mux=ffmpeg{mux=flv}. It seems the quality using the FLV1 codec in the 0.9.8a version had degraded but it could just be the system I'm using for encoding. I have another system running an older version and the quality seems to be better there.

I've also been able to transcode using the h264 video codec but the adobe flash player would not read the HTTP stream. I have it doing rtp to a Wowza media server which is handling my streaming for now as the quality on the h264 is better than FLV1 but I believe encoding h264 is more processor intensive than FLV1.

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 08 Feb 2009 15:50

Yes, it is possible, I could streaming h264 to flash player with vlc, ffmpeg and php.

The input was the video codec in h264 and aac audio.

My vlc commnad is:

output : #transcode{acodec=mp3}:std{access=http,mux=ts,dst=0.0.0.0:8081/stream.ts}

Yes mux=ts, but i use the ffmpeg to change de mux on demand.

I create a php file like this.

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv -");

?>

and its work to any flash player.

Live Stream in h264/aac --> vlc that transcode audio and mux to TS --> ffmpeg that without transcode remux to flv --> flash player

pvthanh
New Cone
New Cone
Posts: 3
Joined: 16 Dec 2008 08:30

Re: FLV streaming on Windows with 0.9.8a

Postby pvthanh » 10 Feb 2009 07:35

That's sound great!
But can you explain: how to play with Flash Player with system(ffmpeg)? is it live transcode? :oops:

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 12 Feb 2009 19:22

you give the video address "http://<your publicip/live.php" to flash player (yes, a php file, this php file will generate the video on the fly with the command system(ffmpeg) )

and the code of de file live.php is

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv -"); //body of video.

?>

the parameter "-" at ffmpeg command indicate stdout as output file.
like:
system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv -");
is the same of
system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv /dev/stdout");

the stdout of command system that run on server is transfered to flash player like a file.

An other sample:

to my vod i used:

system("cat /tmp/somefile.flv");

and now i use:

system("ffmpeg -i somefile.mp4 -vcodec copy -acodec copy -f flv -"); its remux a mp4 file with h264 and aac to flv without transcode.

the live works like vod.

You can listen a sample

http://201.48.87.18/mediacenter/gil
or
http://201.48.87.18/mediacenter/joaopca

rkleemann
Blank Cone
Blank Cone
Posts: 68
Joined: 08 Sep 2004 16:51

Re: FLV streaming on Windows with 0.9.8a

Postby rkleemann » 14 Feb 2009 20:53

Joao,

But I have a question here... I see that you're using ffmpeg with the "copy" vcodec. Then that means that the original encoding must already be h264, correct?

What if we have an encoding source (say using WME) and we want to transcode to h264, and then stream out to flash... can that be done?

Would vlc transcoding to h264 (which works) and then out to stdout, and picked up by live.php... would that work?

Thanks
Ricardo

cable007
Blank Cone
Blank Cone
Posts: 24
Joined: 25 Mar 2008 09:43

Re: FLV streaming on Windows with 0.9.8a

Postby cable007 » 15 Feb 2009 12:20

hello,

can you give us also your html code for your webpage to read your flv stream output ? in resume what we need to create your nice webpages ?
and does it work with live streaming and not files ?

thx

Niko

vel_tins
Blank Cone
Blank Cone
Posts: 81
Joined: 22 Nov 2007 08:51

Re: FLV streaming on Windows with 0.9.8a

Postby vel_tins » 15 Feb 2009 13:57

interesting.. :D
I tried the following:
vlc transcodes a live stream to a h264/aac output file (stream.ts)
then:

Code: Select all

ffmpeg -i http://127.0.0.1:1234/stream.ts -vcodec copy -acodec copy -f flv /dev/stdout
but get the following error:

Code: Select all

Input #0, mpegts, from 'http://127.0.0.1:1234/stream.ts': Duration: N/A, start: 6464.352889, bitrate: N/A Program 1 Stream #0.0[0x44]: Audio: mpeg4aac Stream #0.1[0x45]: Video: h264, yuv420p, 768x576 [PAR 1:1 DAR 4:3], 25.00 tb(r) File '/dev/stdout' already exists. Overwrite ? [y/N] y Output #0, flv, to '/dev/stdout': Stream #0.0: Video: libx264, yuv420p, 768x576 [PAR 0:1 DAR 0:1], q=2-31, 25.00 tb(c) Stream #0.1: Audio: libfaac Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 [flv @ 0x7fedad09a040]sample rate not set
so where and how to set the "sample rate" ?

rkleemann
Blank Cone
Blank Cone
Posts: 68
Joined: 08 Sep 2004 16:51

Re: FLV streaming on Windows with 0.9.8a

Postby rkleemann » 16 Feb 2009 22:40

I'm having trouble getting ffmpeg to work...

I'm transcoding to h264 in vlc, and picking it up with ffmpeg but I get the errors:

Input #0, mpegts, from 'http://127.0.0.1:8100/stream.ts':
Duration: N/A, start: 64573.323867, bitrate: N/A
Program 1
Stream #0.0[0x44], 1/90000: Video: h264, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 1/25, 25.00 tb(r)
Output #0, flv, to 'pipe:':
Stream #0.0, 1/90000: Video: libx264, yuv420p, 176x144, 1/25, q=2-31, 25.00 tb(c)
Stream mapping:
Stream #0.0 -> #0.0
[NULL @ 0x7f127516f780]video codec not compatible with flv


This is how I ran ffmpeg:
ffmpeg -v 2 -i http://127.0.0.1:8100/stream.ts -vcodec copy -acodec copy -f flv -

My ffmpeg info:
FFmpeg version SVN-r13180, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-libmp3lame --enable-libtheora --enable-liba52 --enable-libx264 --enable-libgsm --enable-postproc --enable-libxvid --enable-libfaac --enable-pthreads --enable-libvorbis --enable-libfaad --enable-gpl --enable-x11grab --enable-shared
libavutil version: 49.6.0
libavcodec version: 51.56.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on May 15 2008 22:00:26, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 18 Feb 2009 22:21

interesting.. :D
I tried the following:
vlc transcodes a live stream to a h264/aac output file (stream.ts)
then:

Code: Select all

ffmpeg -i http://127.0.0.1:1234/stream.ts -vcodec copy -acodec copy -f flv /dev/stdout
but get the following error:

Code: Select all

Input #0, mpegts, from 'http://127.0.0.1:1234/stream.ts': Duration: N/A, start: 6464.352889, bitrate: N/A Program 1 Stream #0.0[0x44]: Audio: mpeg4aac Stream #0.1[0x45]: Video: h264, yuv420p, 768x576 [PAR 1:1 DAR 4:3], 25.00 tb(r) File '/dev/stdout' already exists. Overwrite ? [y/N] y Output #0, flv, to '/dev/stdout': Stream #0.0: Video: libx264, yuv420p, 768x576 [PAR 0:1 DAR 0:1], q=2-31, 25.00 tb(c) Stream #0.1: Audio: libfaac Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 [flv @ 0x7fedad09a040]sample rate not set
so where and how to set the "sample rate" ?
try to use acodec mp3 in vlc

this is my ffmpeg log
[h264 @ 0x1defdb0]no frame!
[h264 @ 0x1dee470]non-existing PPS referenced
[h264 @ 0x1dee470]decode_slice_header error
[h264 @ 0x1dee470]no frame!
[h264 @ 0x1df0480]non-existing PPS referenced
[h264 @ 0x1df0480]decode_slice_header error
[h264 @ 0x1df0480]no frame!
[h264 @ 0x1df0480]non-existing PPS referenced
[h264 @ 0x1df0480]decode_slice_header error
[h264 @ 0x1df0480]no frame!
[h264 @ 0x1defdb0]non-existing PPS referenced
[h264 @ 0x1defdb0]decode_slice_header error
[h264 @ 0x1defdb0]no frame!
[h264 @ 0x1defdb0]non-existing PPS referenced
[h264 @ 0x1defdb0]decode_slice_header error
[h264 @ 0x1defdb0]no frame!
[h264 @ 0x1dee470]non-existing PPS referenced
[h264 @ 0x1dee470]decode_slice_header error
[h264 @ 0x1dee470]no frame!
[h264 @ 0x1df0480]non-existing PPS referenced
[h264 @ 0x1df0480]decode_slice_header error
[h264 @ 0x1df0480]no frame!
[h264 @ 0x1defdb0]non-existing PPS referenced
[h264 @ 0x1defdb0]decode_slice_header error
[h264 @ 0x1defdb0]no frame!
Input #0, mpegts, from 'http://localhost:8081/5af669c683f372bd09a2c0c6f4b11244':
Duration: N/A, start: 30641.584033, bitrate: 128 kb/s
Program 1
Stream #0.0[0x44]: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
Stream #0.1[0x45]: Video: h264, yuv420p, 640x480, 25.00 tb(r)
Stream #0.2[0x46]: Video: h264, yuv420p, 176x144, 10.00 tb(r)
Stream #0.3[0x47]: Video: h264, yuv420p, 320x240, 15.00 tb(r)
Output #0, flv, to 'pipe:':
Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 25.00 tb(c)
Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, s16, 128 kb/s
Stream mapping:
Stream #0.1 -> #0.0 [sync #0.0]
Stream #0.0 -> #0.1 [sync #0.1]
Press [q] to stop encoding
frame= 390 fps= 31 q=-1.0 size= 693kB time=16.37 bitrate= 347.0kbits/s

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 18 Feb 2009 22:29

Joao,

But I have a question here... I see that you're using ffmpeg with the "copy" vcodec. Then that means that the original encoding must already be h264, correct?

Correct. and the original acodec mp3, NOT mp4a or lifaac



What if we have an encoding source (say using WME) and we want to transcode to h264, and then stream out to flash... can that be done?

if you need a transcode, you may do it in vlc, and dont in ffmpeg.


Would vlc transcoding to h264 (which works) and then out to stdout, and picked up by live.php... would that work?

NO




Thanks
Ricardo

rkleemann
Blank Cone
Blank Cone
Posts: 68
Joined: 08 Sep 2004 16:51

Re: FLV streaming on Windows with 0.9.8a

Postby rkleemann » 19 Feb 2009 01:26

Here's the error I'm getting (dimension not set). I also tried using the -s option to ffmpeg but didnt help:

$ ffmpeg -i http://127.0.0.1:8100/stream.ts -vcodec copy -acodec copy -f flv -

...
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
Input #0, mpegts, from 'http://127.0.0.1:8100/stream.ts':
Duration: N/A, start: 56634.218478, bitrate: 64 kb/s
Program 1
Stream #0.0[0x44]: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.1[0x45]: Video: h264, yuv420p, 90000.00 tb(r)
Output #0, flv, to 'pipe:':
Stream #0.0: Video: libx264, yuv420p, q=2-31, 90000.00 tb(c)
Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[flv @ 0x7f140449a040]dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?)

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 19 Feb 2009 03:44

Here's the error I'm getting (dimension not set). I also tried using the -s option to ffmpeg but didnt help:

$ ffmpeg -i http://127.0.0.1:8100/stream.ts -vcodec copy -acodec copy -f flv -

...
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
[h264 @ 0x7f14040fb780]non existing PPS referenced
[h264 @ 0x7f14040fb780]decode_slice_header error
[h264 @ 0x7f14040fb780]no frame!
Input #0, mpegts, from 'http://127.0.0.1:8100/stream.ts':
Duration: N/A, start: 56634.218478, bitrate: 64 kb/s
Program 1
Stream #0.0[0x44]: Audio: mp2, 44100 Hz, stereo, 64 kb/s
Stream #0.1[0x45]: Video: h264, yuv420p, 90000.00 tb(r)
Output #0, flv, to 'pipe:':
Stream #0.0: Video: libx264, yuv420p, q=2-31, 90000.00 tb(c)
Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[flv @ 0x7f140449a040]dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?)
the problem is keyframe interval too large
try to reduce de gop size to 1 second.

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 19 Feb 2009 04:09

Your ffmpeg is too old

you need a revision > 13269 and your revision is 13180, and i use 15261



I'm having trouble getting ffmpeg to work...

I'm transcoding to h264 in vlc, and picking it up with ffmpeg but I get the errors:

Input #0, mpegts, from 'http://127.0.0.1:8100/stream.ts':
Duration: N/A, start: 64573.323867, bitrate: N/A
Program 1
Stream #0.0[0x44], 1/90000: Video: h264, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 1/25, 25.00 tb(r)
Output #0, flv, to 'pipe:':
Stream #0.0, 1/90000: Video: libx264, yuv420p, 176x144, 1/25, q=2-31, 25.00 tb(c)
Stream mapping:
Stream #0.0 -> #0.0
[NULL @ 0x7f127516f780]video codec not compatible with flv


This is how I ran ffmpeg:
ffmpeg -v 2 -i http://127.0.0.1:8100/stream.ts -vcodec copy -acodec copy -f flv -

My ffmpeg info:
FFmpeg version SVN-r13180, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-libmp3lame --enable-libtheora --enable-liba52 --enable-libx264 --enable-libgsm --enable-postproc --enable-libxvid --enable-libfaac --enable-pthreads --enable-libvorbis --enable-libfaad --enable-gpl --enable-x11grab --enable-shared
libavutil version: 49.6.0
libavcodec version: 51.56.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on May 15 2008 22:00:26, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

rkleemann
Blank Cone
Blank Cone
Posts: 68
Joined: 08 Sep 2004 16:51

Re: FLV streaming on Windows with 0.9.8a

Postby rkleemann » 19 Feb 2009 06:55

I got it working! :D

I set keyint=50 in the vlc transcode...

Now I do have one problem... my apache error log is getting ALL the output from ffmpeg that's produced from live.php. There's a ton of garbage characters in my error.log

How do I prevent that from happening?

boobee
New Cone
New Cone
Posts: 4
Joined: 19 Feb 2009 08:31

Re: FLV streaming on Windows with 0.9.8a

Postby boobee » 19 Feb 2009 08:38

Hi all,
I've been following your thread since a while, and I've been able to accomplish the generation of an FLV from an MPEG2 live video source.
Actually I'm getting all the stream written into the FLV, so it's not real streaming, because once I open the FLV into an SWF container it starts from the very beginning.

I've been told I need to "stream" the FLV, something ffmpeg cannot accomplish. As ffserver doesn't exist for win32, and all trials of porting it have failed, what can be used to stream it?

I've tried vlc itself but there are too many buffer underruns

Code: Select all

vlc -I dummy -vvv http://localhost:8002/stream.ts --sout #transcode{vcodec=FLV1}:std{access=http,mux=ffmpeg{mux=flv},dst=0.0.0.0:8003/stream1.flv}
and the streaming cannot start from the client side

thanks
b.

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 19 Feb 2009 11:43

I got it working! :D

I set keyint=50 in the vlc transcode...

Now I do have one problem... my apache error log is getting ALL the output from ffmpeg that's produced from live.php. There's a ton of garbage characters in my error.log


How do I prevent that from happening?
try

system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv - 2>/dev/null");
or
system("ffmpeg -i http://127.0.0.1:8081/stream.ts -vcodec copy -acodec copy -f flv - 2>/var/log/ffmpeg/$session.log");

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: FLV streaming on Windows with 0.9.8a

Postby Jean-Baptiste Kempf » 19 Feb 2009 11:51

I wouldn't use ffmpeg for reading ts...
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

jpcaraujo
Blank Cone
Blank Cone
Posts: 13
Joined: 08 Feb 2009 15:35
Location: Brasil

Re: FLV streaming on Windows with 0.9.8a

Postby jpcaraujo » 20 Feb 2009 11:25

I wouldn't use ffmpeg for reading ts...
Do you know another way?


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 7 guests