Skip to content

strips audio stream #2

@alexnauda

Description

@alexnauda

I'm interested in this technique, because I've found that re-encoding individual ts files (or even just remuxing them) with a recent ffmpeg (version N-74407-g45c5585) does not preserve timestamps (and possibly other stuff) from the original ts file, and I'd like to replace it, to ensure interoperability with various players. One thing I've found is that mpegtsShifter is stripping out my audio stream. This seems to be due to a change from commit 242b965, described as "magic" in the commit comment. The audio stream has a zero avg_frame_rate, so this code is calculating a zero frame count and skipping the stream. Do you happen to remember what issue you were fixing when you excluded streams with a zero frame count?

My input ts file looks like this:

$ tsinfo 00000001.ts 
Reading from 00000001.ts
Scanning 10000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
    PID 0101 ( 257) -> Stream type 0f ( 15) 13818-7 Audio with ADTS transport syntax
EOF

Found 430 PAT packets and 215 PMT packets in 10000 TS packets

When I run it through shifter I get many messages like:

[mpegts @ 0x104800c00] Invalid packet stream index: 1
Warning: Could not write frame of stream

And then the output file looks like this:

$ tsinfo sh01.ts 
Reading from sh01.ts
Scanning 10000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
EOF

Found 412 PAT packets and 206 PMT packets in 10000 TS packets

If I remove the changes from 242b965 it passes through the audio, but I wonder if I'm regressing some other fix. The output file after removing the "magic" changes looks like this:

$ tsinfo sh01.ts 
Reading from sh01.ts
Scanning 10000 TS packets

Packet 2 is PAT
Program list:
    Program 1 -> PID 1000 (4096)

Packet 3 is PMT with PID 1000 (4096)
  Program 1, version 0, PCR PID 0100 (256)
  Program streams:
    PID 0100 ( 256) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
    PID 0101 ( 257) -> Stream type 0f ( 15) 13818-7 Audio with ADTS transport syntax
EOF

Found 432 PAT packets and 216 PMT packets in 10000 TS packets

Notice the changes in the PAT and PMT packet counts in the first 10000 packets, compared to the input file. Is this related to the "magic" fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions