Ascoware / get-iplayer-automator

The goal of Get iPlayer Automator is to allow iTunes and your Mac to become the hub for your British Television experience regardless of where in the world you are. Currently, Get iPlayer Automator allows you to download and watch BBC and ITV shows on your Mac. Series-Link/PVR functionality ensures you will never miss your favourite shows. Programmes are fully tagged and added to iTunes automatically upon completion. It is simple and easy to use, and runs on any machine running Mac OS X 10.7 or later. And since the shows are in iTunes, it is extremely easy to transfer them to your iPod, iPhone, or Apple TV allowing you to enjoy your shows on the go or on your television.
GNU General Public License v3.0
146 stars 26 forks source link

BBC programme downloaded from dash stream converted rather than remuxed by ffmpeg #256

Closed jefro108 closed 4 years ago

jefro108 commented 5 years ago

When I tried to download https://www.bbc.co.uk/iplayer/episode/p07hbyjc/untouchable-the-rise-and-fall-of-harvey-weinstein it ended up being downloaded from a dash stream and produced a file 'Untouchable The Rise and Fall of Harvey Weinstein.dash.ts' which ffmpeg then proceded to convert rather than remux!

INFO: Command: "/Applications/Get iPlayer Automator.app/Contents/MacOS/ffmpeg" "-loglevel" "fatal" "-stats" "-y" "-i" "/Volumes/media/Downloads/TV Shows/Untouchable The Rise and Fall of Harvey Weinstein/Untouchable The Rise and Fall of Harvey Weinstein.dash.ts" "-c:v" "libx264" "-c:a" "copy" "-preset" "ultrafast" "-movflags" "+faststart" "-bsf:a" "aac_adtstoasc" "/Volumes/media/Downloads/TV Shows/Untouchable The Rise and Fall of Harvey Weinstein/Untouchable The Rise and Fall of Harvey Weinstein.partial.mp4"

Since the file already contains a H264 and MacOS will even play the file with QuickLook this doesn't seem necessary - plus it takes ages!

File
Name: Untouchable The Rise and Fall of Harvey Weinstein.dash.ts
Size: 2.92 GB (2922224248 bytes)
Kind: Gen2Letter02
UTI: public.mpeg-2-transport-stream
Location: /Volumes/media/Downloads/TV Shows/Untouchable The Rise and Fall of Harvey Weinstein
Created: 1 January 1904 at 00:00:00
Modified: 4 September 2019 at 03:20:32
Container
ID: 1 (0x1)
Format: MPEG-TS
Duration: 1 h 34 min 8 s 640 ms
Overall bit rate mode: Variable
Overall bit rate: 4 138 kb/s
Video
ID: 257 (0x101)
Menu ID: 1 (0x1)
Format: AVC
Format/Info: Advanced Video Codec
Format profile: High@L3.2
Format settings: CABAC / 4 Ref Frames
Format settings, CABAC: Yes
Format settings, ReFrames: 4 frames
Codec ID: 27
Duration: 1 h 34 min 10 s 760 ms
Width: 1 280 pixels
Height: 720 pixels
Pixel aspect ratio: 1.000
Display aspect ratio: 16:9
Frame rate: 50.000 FPS
Frame count: 282538
Color space: YUV
Chroma subsampling: 4:2:0
Bit depth: 8 bits
Scan type: Progressive
Color range: Limited
Color primaries: BT.709
Transfer characteristics: BT.709
Matrix coefficients: BT.709
Audio
ID: 256 (0x100)
Menu ID: 1 (0x1)
Format: AAC LC
Format/Info: Advanced Audio Codec Low Complexity
Format version: Version 4
Muxing mode: ADTS
Codec ID: 15-2
Duration: 1 h 34 min 10 s 688 ms
Bit rate mode: Variable
Channel(s): 2 channels
Channel layout: L R
Sampling rate: 48.0 kHz
Frame rate: 46.875 FPS (1024 SPF)
Compression mode: Lossy
Language: English
Menu/Chapters
ID: 4096 (0x1000)
Menu ID: 1 (0x1)
Duration: 1 h 34 min 8 s 640 ms
List: 256 (0x100) (AAC, English) / 257 (0x101) (AVC)
Language: English
Service name: Service01
Service provider: FFmpeg
Service type: digital television

Surely a simple -c:v copy would suffice?

skovatch commented 4 years ago

What quality settings are you using? I just started a download with BBC TV "Better" and "Best" I'm not getting a DASH stream. I can try to investigate more but I can't reproduce it right now.

GiA used to have logic that detected DASH and tried to convert it with ffmpeg but I removed it when get_iplayer started doing it for you.

jefro108 commented 4 years ago

Even though I am in the UK I use a VPN on my laptop by default to keep my connection secure. Sometimes it has trouble connecting with the BBC without getting 403 errors and ends up using a dash stream which then proceeded to be converted by ffmpeg!

skovatch commented 4 years ago

I have noticed this now as well, unfortunately. All of my 'smart DNS' providers are generating 403 errors, but eventually one works and provides a DASH stream. Then it does the full conversion which kicks the processor into high gear. I can try changing the logic in GiA's local copy of get_iplayer to just do a copy when we get a DASH stream and see how it works.

skovatch commented 4 years ago

OK, removing the aac_adtstoasc still produces a usable MP4 that can be played in TV.app even with a DASH download. According to the get_iplayer forums the 403 errors are happening due to a change on the BBC side and will be addressed in a get_iplayer update. Once that happens I can re-evaluate the situation and see if removing the conversion is still needed.

jefro108 commented 4 years ago

How about removing the libx264 as well ie changing "-c:v" "libx264" to "-c:v" "copy"?

Since the .ts file plays in QuickLook fine - so it is pretty Apple compatible before conversion! 😊

INFO: Converting to MP4 and embedding subtitles
INFO: Command: "/Applications/Get iPlayer Automator.app/Contents/MacOS/ffmpeg" "-loglevel" "fatal" "-stats" "-y" "-i" "/Volumes/media/Downloads/TV Shows/Clangers/Clangers.s03e18.Junk Planet.dash.ts" "-i" "/Volumes/media/Downloads/TV Shows/Clangers/Clangers.s03e18.Junk Planet.srt" "-c:v" "libx264" "-c:a" "copy" "-preset" "ultrafast" "-movflags" "+faststart" "-c:s" "mov_text" "-metadata:s:s:0" "language=eng" "-bsf:a" "aac_adtstoasc" "/Volumes/media/Downloads/TV Shows/Clangers/Clangers.s03e18.Junk Planet.partial.mp4"
skovatch commented 4 years ago

I'm restoring back to what the base get_iplayer does, so none of that will happen now. Expect a new release soon.

skovatch commented 4 years ago

Fixed in 1.17