Advertisement
Guest User

Ugoira to mjpg mkv

a guest
Nov 10th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import json, subprocess
  2.  
  3. with open('ugoira_meta.json') as f:
  4.     data = json.load(f)
  5. f.closed
  6.  
  7. with open('timestamps.txt', 'w') as f:
  8.     f.write('# timestamp format v2\n')
  9.     f.write('0\n')
  10.  
  11.     cur_time = 0
  12.  
  13.     for i in data['body']['frames']:
  14.         cur_time += i['delay']
  15.         f.write(str(cur_time)+"\n")
  16.        
  17. f.closed
  18.  
  19. print(subprocess.run(['ffmpeg',
  20.                 '-framerate',
  21.                 '30',
  22.                 '-i',
  23.                 '%06d.jpg',
  24.                 '-codec',
  25.                 'copy',
  26.                 'mjpg.mkv']))
  27.  
  28. print(subprocess.run(['mkvmerge',
  29.                 '-o',
  30.                 'ugoira.mkv',
  31.                 '-d',
  32.                 '0',
  33.                 '-A',
  34.                 '--timestamps',
  35.                 '0:timestamps.txt',
  36.                 'mjpg.mkv']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement