ffmpeg-cli-wrapper icon indicating copy to clipboard operation
ffmpeg-cli-wrapper copied to clipboard

how to set payload_type

Open chinarui-na opened this issue 4 years ago • 1 comments
trafficstars

The question how to set payload_type and filter_complex . i use addExtraArgs to set it.but it return 'Unrecognized option'

Example ffmpeg command

ffmpeg  -i rtmp://172.16.2.67:1935/live/livestream -vn -acodec pcm_alaw -payload_type 8 -filter_complex 'aresample=8000,asetnsamples=n=160' -ar 8000  -f rtp rtp://172.16.2.96:19132

What you have tried

 FFmpegBuilder builder = new FFmpegBuilder()
                .setInput("rtmp://172.16.2.67:1935/live/livestream")
                .addOutput("rtp://127.0.0.1:19132")
                .setFormat("rtp")
                .disableVideo()
                .setAudioCodec("pcm_alaw")
                .setAudioSampleRate(8000)
                .addExtraArgs("-payload_type 8")
                .addExtraArgs("-filter_complex 'aresample=8000,asetnsamples=n=160'")
                .done();

chinarui-na avatar Jun 03 '21 07:06 chinarui-na

-payload_type 8 is encoded as a single argument. Split that into two, and it should work:

addExtraArgs("-payload_type").addExtraArgs("8")

bramp avatar Jun 03 '21 14:06 bramp