I want to transcode individual mpegts (h264/aac) chunks, and two things are very important:
1) A constant, predictable output bitrate
2) Keeping the original pts information.

For this minimal example I'm using this public accessible mpegts chunk and the least amount of arguments needed to reproduce:
https://bitdash-a.akamaihd.net/content/sintel/hls/1500kbit/seq-38.ts
Let's say I want 300k output bitrate:

Original Chunk:
Duration: 00:00:02.00, start: 76.083333, bitrate: 919 kb/s

Using -copyts I can copy over the timings. Good. But I want 300k.
ffmpeg -i seq-38.ts -vf scale=320:240 -f mpegts -muxdelay 0 -copyts -vcodec libx264 -crf 19 -y seq-38-copyts.ts && ffprobe seq-38-copyts.ts
Duration: 00:00:02.00, start: 76.083333, bitrate: 245 kb/s

Using -muxrate 300k gives me 296k - Good enough. But this is without -copyts. ffmpeg -i seq-38.ts -vf scale=320:240 -f mpegts -muxdelay 0 -vcodec libx264 -crf 19 -y -muxrate 300k seq-38-copyts.ts && ffprobe seq-38-copyts.ts
Duration: 00:00:02.00, start: 0.083333, bitrate: 296 kb/s

Now I'm combining the two, I have the correct start time again, but wtf? 11696 kb/s? ffmpeg -i seq-38.ts -vf scale=320:240 -f mpegts -muxdelay 0 -copyts -vcodec libx264 -crf 19 -y -muxrate 300k seq-38-copyts.ts && ffprobe seq-38-copyts.ts
Duration: 00:00:02.00, start: 76.083333, bitrate: 11696 kb/s


What is happening here, and how can I achieve having the correct timing information while having a very CBR stream? I really want to avoid ffprobing the chunk first and also avoid 2-pass encoding, as this is for very low latency, on-demand transcoding.

Thanks for any suggestions!
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to