PTS calculating for TS-packet
Posted: 25 Nov 2016 13:02
Hello. I developing a java application for capture sound from soundcard, encode it to mp3 and multicast to network. I try to emulate VLC mp3 stream.
All working fine, stream the same, but I have a trouble with calculating PTS.
If I ignore this timestamp, VLC don't play my stream.
How can I calculate this value?
I found formula: (<sample number> * 90000) / <samplerate>. But it does not work. For example, for the first sample at a frequency of 44,100 PTS will be 2.04081632653.
Wireshark shows me: in my first computer, and in my second computer. This is VLC stream of mp3 file (44100 kHz, 2 channels, 192 kb/s) and stream of same file, but 44100kHz, 2 channels and 128kb/s.
Why I have big PTS values? 0x21 0x00 0x01 0x12 0x5d = 141 733 991 005.
How vlc calculate this? Can somebody help me?
P.S.: I see VLC code, FFmpeg code, libavutils code, standards ISO 13818-1, ISO 13818-2... But I don't know how I can simulate this. I asked on forums, but nobody can help me.
All working fine, stream the same, but I have a trouble with calculating PTS.
If I ignore this timestamp, VLC don't play my stream.
How can I calculate this value?
I found formula: (<sample number> * 90000) / <samplerate>. But it does not work. For example, for the first sample at a frequency of 44,100 PTS will be 2.04081632653.
Wireshark shows me: in my first computer, and in my second computer. This is VLC stream of mp3 file (44100 kHz, 2 channels, 192 kb/s) and stream of same file, but 44100kHz, 2 channels and 128kb/s.
Why I have big PTS values? 0x21 0x00 0x01 0x12 0x5d = 141 733 991 005.
How vlc calculate this? Can somebody help me?
P.S.: I see VLC code, FFmpeg code, libavutils code, standards ISO 13818-1, ISO 13818-2... But I don't know how I can simulate this. I asked on forums, but nobody can help me.