Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle transcode failure #163

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added testdata/sine.mp3
Binary file not shown.
14 changes: 10 additions & 4 deletions utils/move_and_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ def get_metadata_(filepath):
filepath,
]
output = subprocess.check_output(cmd)
return json.loads(output.decode('utf-8'))
j = json.loads(output.decode('utf-8'))
# Convert duration from str to number
j['format']['duration'] = float(j['format']['duration'])
return j

def pretty_duration(duration):
min, sec = divmod(duration, 60)
Expand Down Expand Up @@ -230,9 +233,12 @@ def generate_videos(
videofiles = set()
for t in formats:
cmds, new_fn = converter.convert_cmds(filepath, t, metadata)
runner_run(cmds, filepath=new_fn, reprocess=reprocess)
videofiles = register(
id, base_path, videofiles=videofiles)
try:
runner_run(cmds, filepath=new_fn, reprocess=reprocess)
videofiles = register(
id, base_path, videofiles=videofiles)
except subprocess.CalledProcessError as e:
logging.warning('Unable to convert video #%d to %s format' % (id, t))


def _update_video(video_id, data):
Expand Down
2 changes: 2 additions & 0 deletions utils/run-move_and_process
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
set -x

mkdir -p tank/indir/1234 tank/outdir
mkdir -p tank/indir/1235 tank/outdir

cp testdata/white-sine.ogv tank/indir/1234
cp testdata/sine.mp3 tank/indir/1235

utils/move_and_process.py run \
--indir `pwd`/tank/indir \
Expand Down