Tch!  Both Fred and then myself forgot to reply to all ...

-------- Forwarded Message --------
Subject: Re: output format
Date: Tue, 28 Mar 2023 01:13:58 +0100
From: MacFH - C E Macfarlane - News <>
To: fred.d <>

On 27/03/2023 18:54, fred.d wrote:

On 27/03/2023 18:22, MacFH - C E Macfarlane - News wrote:

On 27/03/2023 17:56, fred.d wrote:

Recently started using gip to download sounds and audio files.

Unfortunately I've got my prefs set to force output to mpeg .TS. Result is my downloaded audio is being converted to .ts files unless I override the command line with --raw when downloading audio :-(

What command-line option are you using to set this?

options config file:  mpegts 1

Equivalent to ...

--mpeg-ts Ensure raw audio and video files are re-muxed into MPEG-TS file regardless of stream format. Overrides --raw.

Does anyone know a way to configure gip Video output format separately from Audio output format? I've had a quick look at all the options I have docs on but I can't see anything obvious.

Difficult to say without knowing how you set the preference in the first place.

I think you have two options. The following examples use "Bells On Sunday" (radio) and weather forecasts (TV) as being conveniently short programmes with correspondingly small download sizes to test with. Also, make sure you read the notes below before trying anything out:

1. Leave the option --mpeg-ts as is, but add an additional post-download option for audio files using --command-radio to convert the download to m4a (or any other audio format of your choice). The downside of this is that it may sometimes mean converting audio files twice, depending on the format of the original download.


--command-radio "ffmpeg -i '<filename>' -c:a copy '<fileprefix>.m4a' && del '<filename>" --type radio --pid m001jkbm --raw -g

2. Remove that option altogether and use the --raw option instead, and give different --command-radio and --command-tv options to get the two different types into the respective end formats required. This should ensure that each type only gets converted once.


--command-radio "ffmpeg -i '<filename>' -c:a copy '<fileprefix>.m4a' && del '<filename>" --type radio --pid m001jkbm --raw -g

--command-tv "ffmpeg -i '<filename>' -c:a copy -c:v copy '<fileprefix>.mp4' & del '<filename>" --type tv --tv-quality sd --pid m001kjpf --raw -g


Firstly, note that unless you want to keep the originally downloaded file as well as the converted file, you have to include a command to delete it, the double ampersand means that the del command only happens if the ffmpeg command didn't produce an error code when making the conversion. The command is for a Windows set up, you'd use rm instead of DEL on a Linux system.

Secondly, the above FFMPEG commands are greatly simplified from the original commands that GiP would have fed to FFMPEG without the --mpeg-ts or --raw options being specified, which may be why the video one above corresponding to 2 below gave an avalanche of 'Invalid DTS' messages that don't occur when you let GiP do the job. As the weather video played back alright, I didn't bother to investigate that further.

1) ffmpeg -loglevel fatal -stats -y -i "<path>\Bells On Sunday - Cathedral Church Of St Mary The Virgin With St Paul In Blackburn Lancashire.hls.ts" "-c:v" copy "-c:a" copy "-bsf:a" aac_adtstoasc -movflags faststart "<path>\Bells On Sunday - Cathedral Church Of St Mary The Virgin With St Paul In Blackburn Lancashire.partial.m4a"

2) ffmpeg -loglevel fatal -stats -y -i "<path>\Weather For The Week Ahead - 2023-03-27.hls.ts" "-c:v" copy "-c:a" copy "-bsf:a" aac_adtstoasc -movflags faststart "<path>\Weather For The Week Ahead - 2023-03-27.partial.mp4"

Thirdly, the available substitution parameters to use in the filenames are here, but not all will have values in all circumstances, for example <rawaudio> was empty when I tried it

Lastly, I know that once upon another life in some obscure case I tried to use a post-download command before, but struggled with it for hours, and now can't remember whether actually I ever even got it to work! A significant part of the problem was that, as above, you need to put some parameters in quotes, for example filenames with spaces, but they tend to get stripped off by GetIPlayer when it feeds the quoted parameters to the external command. I remember a lot of faffing around with single quotes inside double, and vice versa, trying to get it to work, but above examples do work on my system!

get_iplayer mailing list

Reply via email to