Fwd: Re: output format
fred.d
fred.d at timelords.org.uk
Thu Mar 30 16:41:51 PDT 2023
...and the final post process command for Windows was:
--pid=12345678 --command-radio "ffmpeg -i \""<filename>"\" -c:a
copy \""<dir>\<fileprefix>.m4a"\" && del \""<filename>"\""
or when set in options file it became:
commandradio ffmpeg -i "<filename>" -c:a copy
"<dir>\<fileprefix>.m4a" && del "<filename>"
which just allows me to type
get_iplayer --pid=12345678
whether it's a video or an audio.
thanks again.
On 29/03/2023 11:05, fred.d wrote:
> Well, that was an interesting diversion.
>
> Having seen your post processing commands, I thought I'd see if I
> could put these in the options file as my aim is just to type "gip
> pid" followed by series or individual PID lists and let gip produce
> the outputs that I want.
> Indeed you can have commands in the options file.
>
> Next I thought - this is daft, if I'm preserving .ts just for video, I
> could try to switch it the other way and post process the video and
> allow the radio to come down on MP3 or M4A. should be even simpler and
> less conversion. So I scrapped the force TS option as a first step and
> sure enough audio came down as M4A.
> ...except it didn't! I happened to have the target directory open when
> I tried another sounds file and noticed that it downloads the radio
> stuff as a .ts then converts.
>
> Now given that video comes down as M4A and M4V, then gets converted to
> .TS before it gets converted to .MP4 I've gone back to the original
> logic and restored force .TS as that actually gives me minimal
> conversion on video. I assume TS to MP4 is lossless and it's a
> container swap but it takes time and as previously stated I prefer to
> edit .ts anyway.
> ...and I'll post process the audio manually using a command in the
> options file as I don't really want that as .ts for audio.
>
> Anyway, thanks for your assistance.
>
>
> On 28/03/2023 16:35, MacFH - C E Macfarlane - News wrote:
>> On 28/03/2023 15:43, MacFH - C E Macfarlane - News wrote:
>>>
>>> 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 <news at macfh.co.uk>
>>> To: fred.d <fred.d at timelords.org.uk>
>>>
>>> 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.
>>>
>>> Example:
>>>
>>> --command-radio "ffmpeg -i '<filename>' -c:a copy '<fileprefix>.m4a'
>>> && del '<filename>" --type radio --pid m001jkbm --raw -g
>>
>> Not sure how this happened when cutting & pasting but every example
>> is missing a closing single quote just before the closing double
>> quote, as follows:
>> del '<filename>'" [<-here]
>>
>> So the above should have read:
>>
>> --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.
>>>
>>> Examples:
>>>
>>> --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
>>
>> As above, should have read:
>>
>> --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
>>
>> Sorry about that.
>>
>>> IMPORTANT! Notes:
>>>
>>> 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
>>>
>>> https://github.com/get-iplayer/get_iplayer/wiki/subparams
>>>
>>> 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
>>> get_iplayer at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/get_iplayer
>>
>>
>> _______________________________________________
>> get_iplayer mailing list
>> get_iplayer at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/get_iplayer
>
>
> _______________________________________________
> get_iplayer mailing list
> get_iplayer at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/get_iplayer
More information about the get_iplayer
mailing list