Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
前番組のSD部分をカット
#!/usr/bin/env python3.1
import sys
from itertools import dropwhile
from ariblib import TransportStreamFile
from ariblib.packet import pid
output = open(sys.argv[2], 'wb')
with TransportStreamFile(sys.argv[1]) as ts:
# SDを捨ててHDを残す場合。逆に前番組のHDを捨ててSDを残す場合は4 (ARIB-STD-B10 第2部第6章 表6-60)
video_pid = ts.get_video_pid(1)
for packet in dropwhile(lambda p: pid(p) == video_pid, ts):
output.write(packet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment