Skip to content

Commit

Permalink
Patch failure occuring with audio files conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Larralde committed Sep 12, 2018
1 parent 9faca3b commit f4edc00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ install:
- pip install .

before_script:
- ffmpeg -version
# test audio conversion
- curl -SsL "https://www.sample-videos.com/audio/mp3/wave.mp3" > test.mp3
- ffmpeg -v error -i test.mp3 -acodec copy -f mp3 - > /dev/null
# test video conversion
- curl -SsL "http://techslides.com/demos/sample-videos/small.mp4" > test.mp4
- ffmpeg -i test.mp4 -vcodec copy test2.mkv
- ffmpeg -v error -i test.mp4 -vcodec copy -f matroska - > /dev/null

script:
- ffpb -i test.mp3 -acodec copy test.mka
- ffpb -i test.mp4 -vcodec copy test.mkv

before_deploy:
Expand Down
18 changes: 13 additions & 5 deletions ffpb.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def newline(self):
return line

def get_fps(self, line):
"""
"""
search = self._FPS_RX.search(line)
if search is not None:
return round(float(search.group(1)))
Expand All @@ -122,16 +120,26 @@ def get_source(self, line):
def progress(self, line):
search = self._PROGRESS_RX.search(line)
if search is not None:

total = self.duration
current = self._seconds(*search.groups())
unit = " seconds"

if self.fps is not None:
unit = " frames"
current *= self.fps
total *= self.fps

if self.pbar is None:
self.pbar = tqdm.tqdm(
desc=self.source,
file=self.file,
total=self.duration * self.fps,
total=total,
dynamic_ncols=True,
unit=" frames",
unit=unit,
ncols=0,
)
current = self._seconds(*search.groups()) * self.fps

self.pbar.update(current - self.pbar.n)


Expand Down

0 comments on commit f4edc00

Please sign in to comment.