Discussion:
Sometimes get file rename error at end of download
Nick Payne
2017-11-25 10:57:47 UTC
Permalink
Running get_iplayer 3.06 on Win10 x64. Sometimes the rename of the mp4
file at the end of a download fails. ffmpeg creates the partial.mp4 file
without any problem, but get_iplayer.pl then fails to rename
.partial.mp4 to mp4. It's not a permissions problem, else ffmpeg would
not be able to create the partial.mp4 file.

The problem doesn't happen on every download, maybe one in three. All
downloads go into the same folder, in which I have full permissions.
Relevant part of the console output from running with --verbose.

INFO: Converting to MP4
INFO: Command: "ffmpeg" "-loglevel" "fatal" "-stats" "-y" "-i"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.dash.m4a"
"-i"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.dash.m4v"
"-c:v" "copy" "-c:a" "copy" "-map" "0:a:0" "-map" "1:v:0"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4"
frame=173860 fps=20666 q=-1.0 Lsize= 1853690kB time=00:57:57.16
bitrate=4367.2kbits/s speed= 413x
INFO: Command exit code 0 (raw code = 0)
ERROR: Could not rename file:
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4
ERROR: Destination file name:
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.mp4
INFO: Skipping all versions of this programme
ERROR: Failed tv: 'Peaky Blinders: Series 4 - 2. Heathens (b09gvn5j)'
Alan Milewczyk
2017-11-25 11:07:37 UTC
Permalink
This post might be inappropriate. Click to display it.
Nick Payne
2017-11-25 11:34:06 UTC
Permalink
Yes, I've seen that other problem too. But in this case I don't see that
it can be a connection issue - at the point where the error happens the
download has completed and all the actions taking place are operations
on local files. And I don't think in either case is it necessary to
force another download. I just manually rename the files to remove the
".partial" or the "temp-xxx..." and they play to completion without problem.
Post by Alan Milewczyk
I get this from time to time, alternatively I get a file with a
-temp-xxxx suffix where xxxxx is a random series of numbers. IIRC it's
been put down to connnection issues. I've read that repeating the
download instruction is supposed to force the correct actions but
that's not worked for me. Forcing a download usually does the job though.
A
Post by Nick Payne
Running get_iplayer 3.06 on Win10 x64. Sometimes the rename of the mp4
file at the end of a download fails. ffmpeg creates the partial.mp4 file
without any problem, but get_iplayer.pl then fails to rename
.partial.mp4 to mp4. It's not a permissions problem, else ffmpeg would
not be able to create the partial.mp4 file.
The problem doesn't happen on every download, maybe one in three. All
downloads go into the same folder, in which I have full permissions.
Relevant part of the console output from running with --verbose.
INFO: Converting to MP4
INFO: Command: "ffmpeg" "-loglevel" "fatal" "-stats" "-y" "-i"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.dash.m4a"
"-i"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.dash.m4v"
"-c:v" "copy" "-c:a" "copy" "-map" "0:a:0" "-map" "1:v:0"
"D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4"
frame=173860 fps=20666 q=-1.0 Lsize= 1853690kB time=00:57:57.16
bitrate=4367.2kbits/s speed= 413x
INFO: Command exit code 0 (raw code = 0)
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.mp4
INFO: Skipping all versions of this programme
ERROR: Failed tv: 'Peaky Blinders: Series 4 - 2. Heathens (b09gvn5j)'
_______________________________________________
get_iplayer mailing list
http://lists.infradead.org/mailman/listinfo/get_iplayer
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
get_iplayer mailing list
http://lists.infradead.org/mailman/listinfo/get_iplayer
Ralph Corderoy
2017-11-25 13:31:47 UTC
Permalink
Hi,

I missed the start of this thread, but jumping in midway...
Post by Nick Payne
INFO: Command: "ffmpeg" "-loglevel" "fatal" "-stats" "-y" "-i"
...
Post by Nick Payne
INFO: Command exit code 0 (raw code = 0)
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.mp4
INFO: Skipping all versions of this programme
IIRC Windows doesn't allow a file to be rename if a process has it open.
I predict that ffmpeg is multiple threads/processes and the one
get_iplayer started, and sees exit successfully with `0', isn't the
"last man standing". One or more of the other ffmpegs are still around,
with a handle on that partial file, causing the rename to fail.

I'd consider this an ffmpeg bug; its main process should only exit when
it knows the others it has started have finished. Meanwhile, you may
want to edit get_iplayer to add a `sleep 3.14;' between the ffmpeg exit
and the rename to make the race condition far less likely. If that
works, let the list know.
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Colin Law
2017-11-25 11:59:08 UTC
Permalink
Post by Nick Payne
Running get_iplayer 3.06 on Win10 x64. Sometimes the rename of the mp4
file at the end of a download fails. ffmpeg creates the partial.mp4 file
without any problem, but get_iplayer.pl then fails to rename
.partial.mp4 to mp4. It's not a permissions problem, else ffmpeg would
not be able to create the partial.mp4 file.
The problem doesn't happen on every download, maybe one in three. All
downloads go into the same folder, in which I have full permissions.
Relevant part of the console output from running with --verbose.
...
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.partial.mp4
D:\Users\Nick\Videos\iplayer\Peaky_Blinders-s04e02-Heathens.mp4
After it fails have a look and see if the destination file already
exists with the non-partial name. That would explain why the rename
fails.

Colin
Continue reading on narkive:
Loading...