Skip to content

Commit

Permalink
update readme and ffmpeg path
Browse files Browse the repository at this point in the history
  • Loading branch information
AlberLC committed Apr 10, 2021
1 parent e5dbf02 commit 20be6ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An application to play sounds through the microphone, perfect for discord or any
1. [Python](https://www.python.org/) - Programming Language.
2. [PySide2](https://pypi.org/project/PySide2/) - The official Python module from the Qt for Python project, which provides access to the complete Qt 5.12+ framework.
3. [keyboard](https://github.com/boppreh/keyboard) - Library to handle the keyboard.
4. [Pydub](https://github.com/jiaaro/pydub) - Manipulate audio with an simple and easy high level interface.
4. [Pydub](https://github.com/jiaaro/pydub) - Manipulate audio with an simple and easy high level interface. Pydub is integrated into this repository as a fork, it is not included in the requirements.
5. [FFmpeg](https://ffmpeg.org/) - A complete, cross-platform solution to record, convert and stream audio and video.


Expand Down
7 changes: 5 additions & 2 deletions pydub/audio_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import sys
import wave
from collections import namedtuple
from pathlib import Path
from tempfile import TemporaryFile, NamedTemporaryFile

from .logging_utils import log_conversion, log_subprocess_output
from .utils import mediainfo_json, fsdecode
from .utils import mediainfo_json, fsdecode, get_encoder_name

try:
from StringIO import StringIO
Expand Down Expand Up @@ -167,7 +168,9 @@ class AudioSegment(object):
first_second = a[:1000] # get the first second of an mp3
slice = a[5000:10000] # get a slice from 5 to 10 seconds of an mp3
"""
converter = './ffmpeg/bin/ffmpeg.exe' # flanagan get_encoder_name() # either ffmpeg or avconv

# flanagan # either ffmpeg or avconv
converter = './ffmpeg/bin/ffmpeg.exe' if Path('ffmpeg').is_dir() else get_encoder_name()

# TODO: remove in 1.0 release
# maintain backwards compatibility for ffmpeg attr (now called converter)
Expand Down
4 changes: 3 additions & 1 deletion pydub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
from functools import wraps
from math import log, ceil
from pathlib import Path
from subprocess import Popen, PIPE
from tempfile import TemporaryFile
from warnings import warn
Expand Down Expand Up @@ -256,7 +257,8 @@ def get_extra_info(stderr):
def mediainfo_json(filepath, read_ahead_limit=-1):
"""Return json dictionary with media info(codec, duration, size, bitrate...) from filepath
"""
prober = './ffmpeg/bin/ffprobe.exe' # flanagan get_prober_name()
prober = './ffmpeg/bin/ffprobe.exe' if Path('ffmpeg').is_dir() else get_prober_name() # flanagan

command_args = [
"-v", "info",
"-show_format",
Expand Down

0 comments on commit 20be6ee

Please sign in to comment.