diff --git a/README.md b/README.md index 13e8a8b..bdee521 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ FFmpeg wrapper for python. It uses FFmpeg binary to provide both FFmpeg and FFpr The beautiful thing about it is that it comes with its own FFmpeg executable. It is compressed, making it the smallest you can find. And becuase its cross-platform and python 3, it is the only option available for building cross-platform apps with ffmpeg in python. +## FFmpeg Version +Uses current FFmpeg version 4.4 + ## Installation pip install pyffmpeg @@ -45,3 +48,9 @@ NB: The above digits is just for illustration ## Wiki The wiki can be located [here](https://github.com/deuteronomy-works/pyffmpeg/wiki) + +## Legal +This library uses prebuilt binaries of FFmpeg licensed under the LGPLv2.1 and can be downloaded at the following links: + * Mac - here + * Linux - here + * Windows - here diff --git a/_test/f.mp3 b/_test/f.mp3 deleted file mode 100644 index 6c96c55..0000000 Binary files a/_test/f.mp3 and /dev/null differ diff --git a/local_probe_t_est.py b/local_probe_t_est.py index 7d2aca7..fc3c346 100644 --- a/local_probe_t_est.py +++ b/local_probe_t_est.py @@ -5,4 +5,5 @@ print(f.duration) -print(f.metadata) +for x in f.metadata: + print(x, '\n') diff --git a/pyffmpeg/__init__.py b/pyffmpeg/__init__.py index fcdd093..1768596 100644 --- a/pyffmpeg/__init__.py +++ b/pyffmpeg/__init__.py @@ -60,8 +60,10 @@ def convert(self, input_file, output_file): print(msg.format(self.loglevel)) self.loglevel = 'fatal' - options = f"{self._ffmpeg_file} -loglevel {self.loglevel} " - options += f"{self._over_write} -i {inf} {out}" + options = "{} -loglevel {} " + options = options.format(self._ffmpeg_file, self.loglevel) + options += "{} -i {} {}" + options = options.format(self._over_write, inf, out) outP = Popen(options, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) self._ffmpeg_instances['convert'] = outP self.error = str(outP.stderr.read(), 'utf-8') diff --git a/pyffmpeg/misc.py b/pyffmpeg/misc.py index 2367600..95414c9 100644 --- a/pyffmpeg/misc.py +++ b/pyffmpeg/misc.py @@ -4,7 +4,7 @@ import os from platform import system -from lzma import decompress +from lzma import decompress, compress from base64 import b64decode, b64encode @@ -62,6 +62,17 @@ def load_ffmpeg_bin(self): return self.ffmpeg_file + def convert_to_py(self, fn: str, target: str): + + with open(fn, 'rb') as f_file: + raw = f_file.read() + + compressed = compress(raw) + bs4 = b64encode(compressed) + smtm = 'contents='+str(bs4) + + with open(target+'.py', 'w') as t_file: + t_file.write(smtm) def fix_splashes(options): if system().lower() == 'windows': diff --git a/pyffmpeg/pseudo_ffprobe.py b/pyffmpeg/pseudo_ffprobe.py index db14b16..8499670 100644 --- a/pyffmpeg/pseudo_ffprobe.py +++ b/pyffmpeg/pseudo_ffprobe.py @@ -33,7 +33,7 @@ def __init__(self, file_name=None): self.start = 0 self.bitrate = 0 self.type = '' - self.metadata = [[0, 1], 1] # mock indeces + self.metadata = [[{}, {}], {}] # mock indeces self.other_metadata = {} self._other_metadata = [] @@ -77,6 +77,11 @@ def _extract_fps(self, stream): def _extract_all(self, stdout): # pick only streams, all of them + + if 'misdetection possible' in stdout: + print('File corrupt or codecs not available for the file') + return + all_streams = stdout.split('Stream mapping')[0] all_streams = all_streams.split('Input')[1] diff --git a/setup.py b/setup.py index 2a91152..c7d5bf6 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='pyffmpeg', - version='2.0.5.1', + version='2.1.0', description='FFmpeg wrapper for python', long_description=long_desc, long_description_content_type='text/markdown', @@ -16,7 +16,7 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent",