PDA

View Full Version : rtmpdump corruption prevention


hsl
11-04-2014, 10:44 PM
Are there any known methods on how to guarantee rtmpdump's output to be fully corruption free? My understanding of the problem is that corruptions sometimes happen when rtmpdump drops the connection and resumes (could someone clarify on this part?).

My current script uses the following algorithm to run rtmpdump:

while True:
rtmpdump //start a fresh rtmpdump download
rtmpdump --resume //resume if necessary
rtmpdump --resume //resume if necessary
output = rtmpdump --resume //do a final check with resume
if output contains "Already Completed":
break


So if a video cannot be completed in 4 resumes, it starts a fresh download. From personal experience, this prevents quite a bit of corruption; however, it's not perfect.

I was doing some research and I found K-S-V's FlvFixer.php script. I'm not sure exactly sure how it works, but I was wondering what if I used it to augment my current code to make it like this:

while True:
rtmpdump //start a fresh rtmpdump download
call FlvFixer.php on partially/fully completed file
rtmpdump --resume //resume if necessary
call FlvFixer.php on partially/fully completed file
rtmpdump --resume //resume if necessary
call FlvFixer.php on partially/fully completed file
output = rtmpdump --resume //do a final check with resume
if output contains "Already Completed":
break


Would this be able to prevent all corruptions? What do you think?

Thanks.

troller12
11-05-2014, 01:47 PM
Hi,

if you want to download any video files with rtmpdump then use the --resume or -e paramater if necessary.In some cases you get corrupted files durring live recordings.So to fix these corrupted files you can try different tools.One tool is called yaflvfix.exe where you just need to drag & drop your video into the file icon but also this tool dosen't work always (50 % maybe).On the other hand you could try a other tool called "Machete" where you can load your file and save it new without any changes.So the tool does rewrite the video header index (keyframe fix).Just try this so for me it works.

greetz

hsl
11-05-2014, 02:53 PM
Hi,

if you want to download any video files with rtmpdump then use the --resume or -e paramater if necessary.In some cases you get corrupted files durring live recordings.So to fix these corrupted files you can try different tools.One tool is called yaflvfix.exe where you just need to drag & drop your video into the file icon but also this tool dosen't work always (50 % maybe).On the other hand you could try a other tool called "Machete" where you can load your file and save it new without any changes.So the tool does rewrite the video header index (keyframe fix).Just try this so for me it works.

greetz

Thanks for the reply. As you can see from my original post, I am most definitely taking advantage of the --resume/-e parameter. It's just that sometimes when resume, corruption like this still happens:

https://pbs.twimg.com/media/Bj-cNeDCUAAE2uI.jpg:large

When I mention corruption, I mean corruption like the picture above. rtmpdump will run till completion. It doesn't tell you that the video is corrupted.

troller12
11-05-2014, 03:09 PM
Hi again,

oh so you mean video information corruption itself if so.Ok listen,so this could also be a player (set filters) issue itself so mostly I get this too in VLC player right after seeking (not happens in other players).So you should try to verify it to see whether the problem was really a broken download.Try to stream the videolink in your player (VLC or MPC etc) and jump to the same time maker where you see the corruption in your downloaded file.Just check this first at same time code so maybe the frame corruption is also in the original file too (saved).Also you can try to download the video again and then check the same time code again.If you get the same problem at same time code then the corruption should be inside of the video and no download issue.If not then it could be a download issue (bad or not constant connection etc) so you will maybe know this problem if you download a packet (rar / zip) files which you can't unrar (CRC error) after.In some cases it can happen so that you need to re-download the file (if the file itself is not broken).

greetz