[FFmpeg-devel] How to change the pcr_pid value when muxing mpegts
storm.dlf at gmail.com
Fri Sep 21 17:20:49 CEST 2012
This is my first message here, so I hope I'm not making any mistake, if so,
Ok, so I need to use the ffmpeg libraries with CLI to convert vids to mpeg2
transport stream, with some fixed parameters of bitrate, framerate, etc...
I have managed to do it using a Windows build ( all this in windows) for
the resulting video to be playable, it needs to have a exact value for the
video stream pid, the audio stream pid and for the pcr pid. I've managed to
change the video and audio pids, but I find impossible to change the pcr
pid using command line. Its value is always the same as the video stream
pid, and for me it is a very big problem.
With all this on mind, I'm going with my questions.
As I can't change the value of the pcr pid using Command Line, I decided to
take the source code, search for the place where the pcr pid value is set
and try to change it. ( and then using crosscompiling, build the library
again, this I have managed to do correctly)
Ok, I found that the value is set in the source code file: "mpegtsenc.c"
there are a couple of places where the value of the video pid is assigned
to the pcr_pid, so I made modifications to the code to change that value (
a simple: "+2" should make the trick) And after trying it for the first
time, and after building correctly the ffmpeg.exe, the video is created,
its size is the correct, the pcr pid value is correctly set, but the video
lenght wont appear and the video aint play. It happened that the value
wasn't introduced to the pmt table so it was like there was no time.
Looking more in the code of mpegtsenc.c I found that the value of the
pcr_pid was used in an if so it wasn't entering it, so I made a little
modification to leave it as it was. With this "trick" I built again the
library and made a new try.
( the modification is just a "-2" to compensate the earlier done "+2" to
let it enter the comparision)
In this case, the video was created with the changed pid for the pcr, it
was introduced in the pmt, and the video has the correct size and lenght,
but it wont play, just a second and the video ends and the time
I will continue investigating, but I have more clues for now in how wich
modification to do for changing the pid of the pcr of the transport stream.
Does anyone have any idea about what can I do??
Sorry for my bad english, and thanks in advance for your replies and time!
More information about the ffmpeg-devel