[FFmpeg-devel] Force PCR pid in a PROGRAM

Marton Balint cus at passwd.hu
Sun Jun 23 11:27:57 EEST 2019

On Tue, 4 Jun 2019, Andreas Håkon wrote:

> Hi,
> Before coding of a new patch, I prefer to ask here for your ideas and thus improve the changes
> of acceptance of the patch.
> I posted before a patch to select which pid will carry the PCR timestamps. This makes sense in
> several scenarios: when using a non-video stream to carry PCR, when using multiple video
> streams, and son on. See it here:
> https://patchwork.ffmpeg.org/patch/12874/
> However, this patch doesn’t support multiple programs, as only one stream can be specified.
> Therefore, I like to improve it to allow the selection of the PCR for each program.
> But, I’m not sure about what the best approach is. Here are some options:
> - Enhance the “mpegtsenc” muxer with a multi-program option for selecting the PCR.
> - Use the “-program” general parameter to mark which stream carries the PCR.
> Examples:
> $ “ffmpeg ... -f mpegts --progid_pcr_pid 1=101 ...”
>   This indicates that for program with id 1 the PCR will be in the pid 101.
> $ “ffmpeg ... -program title=Prog1:st=0,pcr:st=1 -f mpegts ...”
>   Here the first stream in the Prog1 will carry the PCR.

I think setting this via -program is the best approach, because it is a 
per-program setting. The syntax would would be
-program title=Prog1:st=0:st=1:pcr_pid=xxx because I don't see too much 
benefit in specifying the pcr as the stream number. PCR might be a 
separate PID which has no corresponding stream.


More information about the ffmpeg-devel mailing list