Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118079

stream flv over tcp using ffmpeg

$
0
0

I am using FC23 machine and FFMPEG version is 2.8.10

Using below command, I can stream flv over tcp successfully and able to receive it successfully at receiver side as well. I play it using vlc player. Both audio and video are played well.

./ffmpeg -f x11grab -s 1920x1080 -framerate 15 -i :0.0 -f alsa -ac 2 -i hw:1 -vcodec libx264 -r 30 -pix_fmt yuv420p -tune zerolatency -preset ultrafast -acodec aac -strict -2 -ar 48000 -ab 96k -f flv -metadata streamName=naseeb.sdp tcp://127.0.0.1:6666

But in actually i need to do this using an application. So i wrote an application in 'C' language. I have done following things in the application.

1. open `AVOutputFormat` using below API fmt = av_guess_format("flv", NULL , NULL); 2. Get `AVFormatContext` using below API avformat_alloc_output_context2(&oc, fmt, NULL, NULL); 3. Then added streams(audio and video) using required APIs 4. Then open codecs using required APIs 5. Then set the output using below API ret = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE);

When i need to write flv into a file on system then i provide filename in step 5 as muxer.flv. When i need to stream flv over tcp then i provide filename as tcp://127.0.0.1:6666.

when i play muxer.flv using vlc player both video and audio are played well but when it is streamed over network then Green frames are shown for video and audio works very well. I am wondering what extra setting is required when i need to stream it over network?

I have no doubt on Receiver side as it works very well with ffmpeg utility(command mentioned above). Currently i have downloaded ffmpeg 2.8.10 source code and looking into ffmpeg.c file for some extra setting. Till now i have not found anything helpful. Please suggest something why Green frames shown when flv is sent on network where it works well when dump on system hard disk.


Viewing all articles
Browse latest Browse all 118079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>