clive alton
clive alton

Reputation: 141

Fixing a TS file made by the HD Home Run

I am recording from a cable stream using the hdhomerun command line tool, hdhomerun_config, to a .ts file. The way it works is that you run the command, it produces periods every second or so to let you know that the stream is being successfully recorded. So when I record, it produces only periods, which is desired. And the way to end it is by doing a Ctrl-C. However, whenever I try to convert this to an avi or a mov using FFMpeg, it gives a bunch of errors, some of which being

[mpeg2video @ 0x7fbb4401a000] Invalid frame dimensions 0x0
[mpegts @ 0x7fbb44819600] PES packet size mismatch
[ac3 @ 0x7fbb44015c00] incomplete frame

It still creates the file, but it is bad quality and it doesn't work with OpenCV and other services. Has anyone else encountered this problem? Does anyone have any knowledge that may help with this situation? I tried to trim the ts file but most things require conversion before editing. Thank you!

Upvotes: 1

Views: 1521

Answers (1)

Nick
Nick

Reputation: 46

Warnings/errors like that are normal at the very start of the stream as the recording started mid stream (ie mid PES packet) and ffmpeg expects PES headers (ie the start of the PES packet). Once ffmpeg finds the next PES header it will be happy (0-500ms later in play time).

Short version is that it is harmless. You could eliminate the warnings/errors but removing all TS-frames for each ES until you hit a payload unit start flag, but that is what ffmpeg is already doing itself.

If you see additional warnings/errors after the initial/start then there might be a reception of packet loss issue that needs investigation.

Upvotes: 3

Related Questions