FFmpeg-Android icon indicating copy to clipboard operation
FFmpeg-Android copied to clipboard

librtmp

Open wmsgeek opened this issue 11 years ago • 5 comments

Hello, after compiling how do we pas the complex rtmp urls? example : rtmp://host.com/live playpath=123 swfUrl=http://host.com/123.swf live=1 pageUrl=http://website.tv timeout=10 token=token do we send as AVOptions to Vitamio or just like a normal link. thanks

wmsgeek avatar Feb 05 '14 21:02 wmsgeek

The RTMP url is passed as the output location to the FFmpeg libraries just like any other path. The process for instructing FFmpeg to write data to "test.mp4" and "rtmp://test.com/teststream" is identical from a client programmer's perspective. As long as you pass a well-formed URL, it should work.

Beyond passing the url, you'll have to make sure your AVFormatContext and AVCodecContext are populated correctly. This is a larger question that will probably be better served by the FFmpeg community and lots of personal experimentation. I'm still figuring out how to properly specify all the necessary parameters myself.

I have some example JNI glue code you can check out. It covers the simple case of writing AV packets to FFmpeg with the following process:

  • Prepare an AVFormatContext with your format & codec parameteres (prepareAVFormatContext)
  • Write packets to the AVFormatContext (writeAVPacketFromEncodedData)
  • Finalize the AVFormatContext when complete. (finalizeAVFormatContext)

OnlyInAmerica avatar Feb 05 '14 21:02 OnlyInAmerica

woah, and here i though we could just pas parameters directly to FFMPEG, my luck. that would be not possible by me :/ this was for a live streaming app. i can just use AVOptions but parameters like token are not available (as input). thanks

wmsgeek avatar Feb 05 '14 21:02 wmsgeek

You can build the ffmpeg binary by removing the --disable-programs flag in build_ffmpeg_for_android.sh, then simply call the binary from Java. In that case you'd do something like:

ffmpeg -re -i input.mp4 -codec copy -f flv rtmp://your_url

This would only be useful if you're trying to stream a pre-existing file on the Android device to an rtmp endpoint.

OnlyInAmerica avatar Feb 05 '14 22:02 OnlyInAmerica

I guess you didnt get my point. The idea is to pas rtmp parameters as input not output to rtmp, the app I have is to watch tv streams it does not broadcast. Like we use AVoption in Vitamio (rtmp_xx) my plan was to use librtmp parameters I hope you can give me an idea how this can be done. I can link you to my app if required.

wmsgeek avatar Feb 06 '14 00:02 wmsgeek

4 years later but... you were trying to kill a fly with a nuclear bomb... why using a whole ffmpeg just to read rtmp stream?

I was in university [2010] and there was already java api to handle this kind of video data

bolds07 avatar Jun 04 '18 03:06 bolds07