Thursday, 23 January 2020

Prevent re-buffering on changing max bit rate in ExoPlayer

I am using setMaxBitrate provided by DefaultTrackSelector to set max bit rate when user changes video quality.

val parameters = defaultTrackSelector.buildUponParameters()
            .setMaxVideoBitrate(bitrate)
            .build()

defaultTrackSelector.parameters = parameters

But as soon as this function is called, the current buffer is discarded & re-buffering is shown right away. Is there any way to keep playing using old buffer & just load the new buffer using the new bitrate settings like YouTube does?

This issue has been discussed here: https://github.com/google/ExoPlayer/issues/3522 https://github.com/google/ExoPlayer/issues/2250

But there doesn't seem to be any solution yet. Any help regarding this issue would be appreciated. Thanks in advance.



from Prevent re-buffering on changing max bit rate in ExoPlayer

How to include PyInstaller inside a PyInstaller bundle?

I want to freeze a Python application that has, as one of its features, the ability to produce freezed Python applications using PyInstaller. Here is a minimal application showing what I want to achieve:

import PyInstaller.__main__

with open('inception', 'w', encoding='utf-8') as f:
    f.write('import sys; print("Hello from the inside")\n')
PyInstaller.__main__.run(['--noconfirm', '--onedir', 'inception'])

Freezing this with PyInstaller

PS> pyinstaller --noconfirm --onedir example.py

should produce an executable exemple.exe that can be executed to produce inception.exe.

On the first try, I got the following error

PS> .\dist\example\example.exe
PyInstaller cannot check for assembly dependencies.
Please install pywin32-ctypes.

pip install pywin32-ctypes

This was fixed by installing pywin32 (pywin32-ctypes was already installed) and changing PyInstaller's compat.py file as explained here. Rebundling the application now results in the following error

PS> .\dist\example\example.exe
Traceback (most recent call last):
  File "example.py", line 2, in <module>
    import PyInstaller.__main__
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "d:\code\stackoverflow\pyinstaller_inception\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\PyInstaller\__init__.py", line 66, in <module>
  File "lib\site-packages\pkg_resources\__init__.py", line 481, in get_distribution
  File "lib\site-packages\pkg_resources\__init__.py", line 357, in get_provider
  File "lib\site-packages\pkg_resources\__init__.py", line 900, in require
  File "lib\site-packages\pkg_resources\__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'PyInstaller' distribution was not found and is required by the application
[14376] Failed to execute script example

So it seems like PyInstaller does not bundle itself inside the application. There is an issue on PyInstaller github page, but it does not really help. Is this even possible? If so, how?

This needs to run on Windows 10, with Python 3.7. I am using PyInstaller version 3.5.



from How to include PyInstaller inside a PyInstaller bundle?

Custom NER for identifying products

I am trying to buld a custom named entity extractor for product names and their model numbers.

My use case contains sentences like: "Microsoft used product ABC-300 and also integrated it with ASQ". Product mentioned in the above sentence are: ABC-300 and ASQ

I have already tried using Stanford and Spacy NER, accuracy of both is less than desired.

Are there any datasets that contain product names in paragraphs or sentences I can use for training custom NER model? The sentences for training can be simple or complex. Any kind of data will be useful.

Any leads on how to approach this problem with less training data will also be appreciated.



from Custom NER for identifying products