0

I need to create a MPTS (multi-program transport stream) containing multiple resolutions/bit rates from a single input. For example, from an 1080p input source, create a single file with 720, 576, 340 resolutions muxed into a single MPTS.

The command below works, but only if you know in advance what streams are in the source file:

ffmpeg \ -copyts \ -i someInput \ -filter_complex '[v:0]format=yuv420p[prog];[prog]split=2[split0][split1];[split0]scale=640:-1[out0];[split1]scale=320:-1[out1]' \ -sws_flags bilinear \ -c:a copy -c:s copy \ -program st=0:st=1:title=Pelican640 -metadata:p:0 service_provider="Pelican" \ -map '[out0]' -map 0:a? -map 0:d? \ -c:v libx264 -b:v:0 6M \ -program st=2:st=1:title=Pelican320 -metadata:p:1 service_provider="Pelican" \ -map '[out1]' -map 0:a? -map 0:d? \ -c:v libx264 -b:v:1 2M \ -flush_packets 0 \ -f mpegts -mpegts_copyts 1 -mpegts_flags initial_discontinuity -muxrate 10M \ mptsOutputFile.ts 

The -program st=0:st=1 and -program st=2:st=1 choose which streams to go into each program/service as described in the PAT/PMT.

But that works if the input has only one audio. I'd like to pass all available audio streams from the (single) input and included them in all output programs. Same goes for "data" streams like SCTE-35 and Teletex. They should be transparently copied and included in the output program.

As I understand how the -program option works, -program st=0:st=1 creates a MPEG-TS program containing the first video ([out0] as mapped) and the stream #1 which is the first audio. -program st=2:st=1 does a similar thing. But if reading from the network, you don't know in advance how many audio/data streams exist in the stream...

Is there a way to include all audio/data streams in the program? Something equivalent to -program st=0:st=a:?:st=d:?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.