Skip to content

Commit

Permalink
fix: videos downloaded via yt-dlp doesn't have audio (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomiguelino authored Dec 4, 2024
1 parent 7dd6d49 commit 3168284
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ def download_video_from_youtube(uri, asset_id):
info = json.loads(check_output(['yt-dlp', '-j', uri]))
duration = info['duration']

location = path.join(home, 'screenly_assets', asset_id)
location = path.join(
home,
'screenly_assets',
f'{asset_id}.mp4'
)
thread = YoutubeDownloadThread(location, uri, asset_id)
thread.daemon = True
thread.start()
Expand All @@ -376,7 +380,14 @@ def __init__(self, location, uri, asset_id):

def run(self):
publisher = ZmqPublisher.get_instance()
call(['yt-dlp', '-f', 'mp4', '-o', self.location, self.uri])
call([
'yt-dlp',
'-S',
'vcodec:h264,fps,res:1080,acodec:m4a',
'-o',
self.location,
self.uri,
])

try:
asset = Asset.objects.get(asset_id=self.asset_id)
Expand Down

0 comments on commit 3168284

Please sign in to comment.