bottletop
Active Member
What's this all about?
This is an attempt to retrospectively tidy up a discussion on an old thread that veered off topic a little and may have polluted the original thread. Moving that discussion into it's own thread, here, may make it easier to digest.This is a long post about how to help the HDR to cope with large download files from iPlayer via qtube and youtube-dl.
This section is an accumulation of ideas and suggestions from the pages on this thread.
Why use the HDR?
- pros: save energy. If it's for extended periods, why not use it? Also as it'll store the download file, we can keep it there for viewing on the main TV.
- cons: the HDR is circa 2011, limited CPU power, memory, etc. But the magic that hummy.tv and the CFW adds to this unit makes it a very flexible device.
- cons: the HDR is circa 2011, limited CPU power, memory, etc. But the magic that hummy.tv and the CFW adds to this unit makes it a very flexible device.
Preamble: Please refer to original threads for some background information.
https://hummy.tv/forum/threads/qtube-webif-front-end-for-youtube-dl.8948/
https://hummy.tv/forum/threads/what-is-an-malformed-aac-bitstream.11136/
There is a deficiency in the way youtube-dl handles large files from iPlayer.
This is noticeable with the long duration files produced for some sporting events eg 5 hours of tennis.
There are some issues that the current process has trouble with, namely
large files may take time to download on non fibre connections (this is for info only and not addressed here)
post processing of the large file downloaded by youtube-dl - ie the fixup process.
post processing of the large file downloaded by youtube-dl - ie the fixup process.
youtube-dl fixup process
This can be bypassed by supplying
--fixup warn
or --fixup never
for youtube-dl
This will ensure youtube-dl performs the download then skip the fixup processing.
The resultant MP4 will be playable on HDR but without cue/review feature.
If don't miss cue/review then stop here, enjoy the download. The quality is not bad and you'll save time and effort.
The resultant MP4 will be playable on HDR but without cue/review feature.
If don't miss cue/review then stop here, enjoy the download. The quality is not bad and you'll save time and effort.
Read on if you require fixup processing. The HDR with CFW will help.
Under normal circumstance the HDR will fail during the later stages of the fixup process.
The HDR will eventually grind to a halt and not respond to the remote, WebIF, telnet, ssh, ping etc.
We suspect that reason why it fails is a combination of swapfile size and file contention. The fixup produces a large file that may have issues with the Humax DLNA server.
Use one of the the solutions below to get fixup processing to complete.
The HDR will eventually grind to a halt and not respond to the remote, WebIF, telnet, ssh, ping etc.
We suspect that reason why it fails is a combination of swapfile size and file contention. The fixup produces a large file that may have issues with the Humax DLNA server.
Use one of the the solutions below to get fixup processing to complete.
Solution 1. Get HDR to perform fixup processing - with Content sharing Off.
Use swapfile 600MB-1024MB. Disable Content Share.
Kick off qtube/youtube-dl with fixup.
It will complain near the end. It will exhibit audio and video stutters before settling on a blank screen, no audio for 1-2 hours! It will eventually finish. This solution is most taxing for the HDR.
Kick off qtube/youtube-dl with fixup.
It will complain near the end. It will exhibit audio and video stutters before settling on a blank screen, no audio for 1-2 hours! It will eventually finish. This solution is most taxing for the HDR.
Solution 2. Get HDR to perform fixup processing - with Content sharing On.
Use swapfile 600MB-1024MB. Leave Content Share On. Save to alternative (non DLNA) destination like /mnt/hd2/virtual_disk/ (e.g. install
This is similar to solution 1, but saving to another location and leaving Humax DLNA on.
virtual-disk2
).This is similar to solution 1, but saving to another location and leaving Humax DLNA on.
Solution 3. Get HDR to perform fixup processing - with HDR in maintenance mode.
Use swapfile 128MB. Content Share N/A as it is in maintenance mode.
This is the least taxing option for the HDR and the fastest. It can process 3GB in 10 minutes.
It requires user to use the command line and not have normal TV while running the commands.
First we need to run qtube/youtube-dl and bypass fixup processing, as above.
Set HDR to maintenance mode and reboot
(WebIF/Diagnostics/Maintenace Mode/Enable, WebIF/Diagnostics/Reboot System/Restart)
We will run the commands for fixup processing manually.
This is the least taxing option for the HDR and the fastest. It can process 3GB in 10 minutes.
It requires user to use the command line and not have normal TV while running the commands.
First we need to run qtube/youtube-dl and bypass fixup processing, as above.
Set HDR to maintenance mode and reboot
(WebIF/Diagnostics/Maintenace Mode/Enable, WebIF/Diagnostics/Reboot System/Restart)
We will run the commands for fixup processing manually.
Code:
#maintenace mode access
#telnet into HDR
telnet <HDR IP-address>
#drop into cli
cli
#start swapfile
/mod/etc/init.d/S00swapper start
#check free memory - is swapfile available?
free -m
#go to directory that has the downloaded file
cd '/mnt/hd2/My Video/Eastbourne-2024'
#check file for media errors
ffprobe -show_streams 'file:<filename>.mp4'
#(Fixup process) If there are errors from ffprobe, perform manual fixup by (save to same dir is ok. No DLNA running)
ffmpeg -y -loglevel 'repeat+info' -i 'file:<filename>.mp4' -c copy -f mp4 '-bsf:a' aac_adtstoasc 'file:<filename>-fixup.mp4'
#leave maintenace mode, reboot
exit
x
y
Solution 4. Get HDR to perform fixup processing - with HDR in normal mode.
Ideally use swapfile 256MB. Content Share On.
This solution uses bits of solution 2 and 3. It is nowhere as fast as solution 3, but has the benefit of allowing user to watch HDR TV while running the process. The runtime for a 7GB file fixup is approximately 1 hour. Near the end of that period, you will lose audio and video for roughly 5 minutes.
The steps are the similar to solution 3, except we will use the HDR in normal mode so these are the differences:
No need to start swapfile, it should be in use already.
The output file of last command
You can reduce AV stutter by not viewing live TV, so view a recording or even leave the unit on BBC Red Button channel 250.
Lighten the load on HDR
WebIF/Auto-Processing Settings/Choose hours during which automatic processing runs:/Disable during - select the next 3 hours/set
WebIF/Services/Temporaily - disable most services except dropbear, lighttpd, ntp, recmon & virtual-disk
After fixup produces the new file, re-enable services and set auto processing to your preferred settings.
This solution uses bits of solution 2 and 3. It is nowhere as fast as solution 3, but has the benefit of allowing user to watch HDR TV while running the process. The runtime for a 7GB file fixup is approximately 1 hour. Near the end of that period, you will lose audio and video for roughly 5 minutes.
The steps are the similar to solution 3, except we will use the HDR in normal mode so these are the differences:
No need to start swapfile, it should be in use already.
The output file of last command
ffmpeg
should store <newfile> in a location that DLNA index will not access. Eg like solution 2.You can reduce AV stutter by not viewing live TV, so view a recording or even leave the unit on BBC Red Button channel 250.
Lighten the load on HDR
WebIF/Auto-Processing Settings/Choose hours during which automatic processing runs:/Disable during - select the next 3 hours/set
WebIF/Services/Temporaily - disable most services except dropbear, lighttpd, ntp, recmon & virtual-disk
Code:
#telnet into HDR - you can also use ssh or WebIF/Diagnostics/Command Line
telnet <HDR IP-address>
#drop into cli
cli
#check free memory - is swapfile available?
free -m
#set input filename
infile='/mnt/hd2/My Video/wimbledon-2024/Wimbledon_2024_Day_1_Afternoon_and_Evening.mp4'
#output filenames have suffix '-fixup.mp4.temp', before rename at end to '-fixup.mp4'
outfile1=$infile ;outfile1="${outfile1/.mp4/-fixup.mp4.temp}"
outfile2=$infile ;outfile2="${outfile1/-fixup.mp4.temp/-fixup.mp4}"
#check file for media errors
ffprobe -show_streams -i "${infile}"
#may need coreutils
#(Background Fixup process) If there are errors from ffprobe, perform manual fixup by
nice --2 cpulimit -l 55 -- nohup ffmpeg -y -loglevel 'repeat+info' -i "${infile}" -c copy -f mp4 '-bsf:a' aac_adtstoasc -threads 1 "${outfile1}" > ffmpeg-output && mv "${outfile1}" "${outfile2}" &
#leave cli, close connection
exit
x
So, which solution is best?
Solution 3 has the shortest run time while solution 4 minimises TV downtime. The first two solutions are easier to perform, but they will interupt your TV viewing experience and take a long time to run.
Adjusting swapfile size
I am lazy - I leave my swapfile set to 1024MB. But this is not best practice. It's best to leave it at 256MB.How to change your swapfile size - https://hummy.tv/forum/threads/swapper-virtual-memory.8844/post-171196
eg
Code:
echo 600 >/mod/boot/swapsize
Suggestions for fixup output file
Locations for placing fixup output file away from the reach of Humax DLNA.The first one is directly accessible by the Humax UI (Media-Video/Storage(blue)/USB), so with the others you'll need to move the file into My Video.
/mnt/hd2/virtual_disk/
/mnt/hd2/Tsr/
/mnt/hd2/mod/
/mnt/hd2/mod/tmp/
Alternatively simply use file extension like .temp instead of .mp4!
The Humax DLNA will serve only certain file extensions.
eg https://hummy.tv/forum/threads/youtube-dl-mp4-issues.9913/#post-150221
and https://www.sony.com/electronics/support/articles/S1F0959
What follows was the original post that started this discussion...
There may be a bug in the interaction between qtube and youtube-dl.I've tried this on 2 occasions and it looks like youtube-dl caused the HDR to hang during the final stages of the download (the fixup stage).
Code:
16/06/2024 08:36:08 - [debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:/mnt/hd2/My Video/Tennis_-_Nottingham_Open_2024_Day_6.mp4' -c copy -f mp4 '-bsf:a' aac_adtstoasc 'file:/mnt/hd2/My Video/Tennis_-_Nottingham_Open_2024_Day_6.temp.mp4'
16/06/2024 08:36:08 - [ffmpeg] Fixing malformed AAC bitstream in "/mnt/hd2/My Video/Tennis_-_Nottingham_Open_2024_Day_6.mp4"
16/06/2024 08:36:06 - [debug] ffmpeg command line: ffprobe -show_streams 'file:/mnt/hd2/My Video/Tennis_-_Nottingham_Open_2024_Day_6.mp4'
16/06/2024 08:36:04 - [download] Download completed
16/06/2024 05:52:48 - [download] Destination: /mnt/hd2/My Video/Tennis_-_Nottingham_Open_2024_Day_6.mp4
16/06/2024 05:52:48 - [hlsnative] Total fragments: 2158
16/06/2024 05:52:46 - [hlsnative] Downloading m3u8 manifest
So I cycled power using the rear switch.
On resume - qtube tries to continue where it left off - so the HDR will hang again!
What I did to work around the issue
- cycle power to the HDR
- access HDR (eg telnet) and rename the queue file -
mv /mnt/hd2/mod/etc/queue.db /mnt/hd2/mod/etc/queue.bak1
- restart the HDR
- delete the temp file
- use the first downloaded file
The smaller files are over 5GB and the uninterrupted ones over 11GB, so they'll take a while on ADSL broadband.
There may be a better way to work around the issue. Eg just perform download without the fix by supplying
--fixup warn
to youtube-dl (I've since tested this and it works for these iPlayer downloads, alternatively increase swap file size as in link below).Note2: Ignore me it's been reported before - https://hummy.tv/forum/threads/what-is-an-malformed-aac-bitstream.11136/
Last edited: