yasea icon indicating copy to clipboard operation
yasea copied to clipboard

how to stream rtmp from mp4 file

Open pratheepchowdhary opened this issue 6 years ago • 8 comments

how to stream rtmp from mp4 file

pratheepchowdhary avatar Sep 05 '17 10:09 pratheepchowdhary

Use ffmpeg.

ffmpeg -re -i input.mp4 -vcodec libx264 -acodec copy -f flv rtmp://host[:port]/app/stream

begeekmyfriend avatar Sep 05 '17 15:09 begeekmyfriend

Thank u for response sir I know this command sir How I can excute above ffmpeg command in this android library While sample code shows stream from camera

pratheepchowdhary avatar Sep 05 '17 15:09 pratheepchowdhary

The output of camera is so called raw data, i.e. NV21, NV12, I420... The output of video encoder is so called ES(encoded stream), i.e. H.264, H.265... The formats that encapsulate ES are so called containers, i.e. FLV, MP4... In FFmpeg, the movements include transferring MP4 format into FLV and wrapping with RTMP. Therefore the actual container under RTMP is FLV but not MP4.

begeekmyfriend avatar Sep 06 '17 01:09 begeekmyfriend

Hello sir iam asking about how to excute ffmpeg command with this library can you tell me the code please

pratheepchowdhary avatar Sep 06 '17 03:09 pratheepchowdhary

I mean there is no FFmpeg code in this SDK. If you want to stream MP4 files under RTMP. You need to unpack MP4 files as H.264 and the pack it into FLV. The H.264 and AAC sending interfaces are flvMuxer.writeSampleData and flvMuxer.writeSampleData.

begeekmyfriend avatar Sep 06 '17 05:09 begeekmyfriend

Due to I am new for development I am not get you can you tell sample example code to pass mp4 file to stream in rtmp help me sir please

pratheepchowdhary avatar Sep 06 '17 07:09 pratheepchowdhary

@pratheepchowdhary 解决了吗? 我也想把mp4用rtmp来推流

lynx-liu avatar Jan 23 '18 10:01 lynx-liu

Hi @begeekmyfriend ! Do You think to update the demo project with this request?

francescogatto avatar Apr 15 '21 09:04 francescogatto