ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
129.71k stars 9.78k forks source link

Howto convert unfinished .mp4.part to .mp4 #27071

Open laszlokorte opened 3 years ago

laszlokorte commented 3 years ago

Checklist

Question

I used youtube-dl to download a livestream but accidentally turned off my power in the middle. Now I have an 1GB .mp4.part file on my disk. I already tried to open it with VLC player and repairing it with untrunc but it does not work. I assume youtube-dl has it's own file format the .part file written to disk. Obviously I can not just redownload because it has been a live stream I was planning to watch later.

Is there a way to convert the unfinished .mp4.part file to a .mp4 file?

arian81 commented 3 years ago

It may sound ridiculous but I had success seeing parts of the video when I removed the .part from the extension.

benwh1 commented 3 years ago

You might be able to fix it with ffmpeg using ffmpeg -i input.mp4.part -c copy output.mkv

laszlokorte commented 3 years ago
$ ffmpeg -i "myfile.mp4.part" -c copy "myfile.mkv"
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x143e1c0] moov atom not found
myfile.mp4.part: Invalid data found when processing input
adithya-s-sekhar commented 3 years ago

Is it possible to share the url to a similar stream?

If you can get a few working videos from the same source, you can identify and copy paste the header from the working one to the broken one with any hex editor. Make sure you are working on a copy btw, don't risk messing up the original. https://forum.videohelp.com/threads/362685-Repair-mp4#post2304757

I've had some sucess with this method.

zamanuhina commented 3 years ago

Use: --no-part

laszlokorte commented 3 years ago

@zamanuhina but that only works for new downloads right?

zamanuhina commented 3 years ago

@zamanuhina but that only works for new downloads right?

Yes.

Maybe: ffmpeg -i input_video_file.mp4 -vcodec copy -acodec copy -movflags faststart output_video_file.mp4

Lapin0t commented 3 years ago

Did you try with https://github.com/anthwlock/untrunc? (a fork which is tons faster). Also try with another example file, maybe you didn't pick one with the same format (get some random streams from the same host).

Note: this happened to me (i recovered) and i'd guess it's quite common when recording streams. Maybe the FAQ could reference to untrunc (which is the tool for the job) and the ffmpeg faststart thing.

damien5999 commented 3 years ago

Did you try with https://github.com/anthwlock/untrunc? (a fork which is tons faster). Also try with another example file, maybe you didn't pick one with the same format (get some random streams from the same host).

Note: this happened to me (i recovered) and i'd guess it's quite common when recording streams. Maybe the FAQ could reference to untrunc (which is the tool for the job) and the ffmpeg faststart thing.

This worked for me! after acdently formating an SD card from my canon camera I first recovered everything possible from the card, but the video files were only showing all black... after trying everything else, from quicktime, to renaming the files, vlc, thekmplayer, etc I finally stumbled upon this post... the key here, is that it uses a SOURCE FILE that needs to also be a good working video from the SAME CAMERA, which i have! So happy! thanks! Also sent the author of the software $10 :-)