Skip to content

Instantly share code, notes, and snippets.

@youzaka
Created September 9, 2012 11:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save youzaka/3683870 to your computer and use it in GitHub Desktop.
Save youzaka/3683870 to your computer and use it in GitHub Desktop.
前番組の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