Warning:
You cannot easily undo this using CMD.exe
or any other simple Windows tools.
To do, as you have actually asked, add a few characters, you can use the Windows copy
command.
First, use Notepad, or some other editor, to create a file with a few characters in it. Perhaps it could be "Don't Play This!". Of course, just one space, or any other character, would be enough. Save the file using a name you want, say NoPlay.txt
.
The command COPY /b NoPlay.txt+MyVideo.mp4 LockedVideo.mp4
will create the new file LockedVideo.mp4
by combining the two files NoPlay.txt
and MyVideo.mp4
. The /b
tells copy to use binary mode, so it will not try to do anything to the files other than copy them. (Change the names to suit your files.)
Now the new file will be a "corrupted" video file, the player will detect that, and fail to play the file. It may not even recognize it as a video file at all.
As stated in the warning at the top, using Windows commands the reversal of the "corruption" is not simple. Probably not even possible with commands directly. A hex editor could be used to fix it, but that's not exactly a smooth workflow.
Using Linux, however, to reverse the corruption is almost trivial.
Taking the sample given above: Don't Play This!
, there are 16 characters. How, and where, the file is created can change how real size of that file. Whether or not the file has an Enter at the end, and if it has Windows or Linux line endings matters.
In Windows, and Linux, the directory listing (DIR
or ls -l
) will show the real size, and you need to know that for unlocking the file. On Linux, using the echo
command to create the file makes it 17 bytes in size. With the known exact size of the file you use replacing the 17
in the command below, you can unlock the video. I'll stick to using the same file names as used in the corruption process above. The obvious use of dd
will work, but you won't like the speed.
dd if=dd if=LockedVideo.mp4 of=MyVideo.mp4 bs=1 skip=17
The reason for the options is that skip
is the number of blocks to skip. With the default block size of 512 bytes it would remove too much, even with skip=1
. Setting the block size to one, bs=1
, you have complete control over the number of bytes skipped. The downside is that dd
will read one block, write one block, repeat. For a 1.5 GB file, that's going to take a very long time. dd
has a work around for this, iflag=skip_bytes
meaning that the skip value is bytes, not blocks. With that option you can still control the number of bytes dropped, but use a larger block size. (Videos are often involved with DVDs so a block size of 4K seems reasonable.)
dd if=LockedVideo.mp4 of=MyVideo.mp4 bs=4096 iflag=skip_bytes skip=17
A Different, All-Linux, Approach
If, as the edit to the question suggest, you're willing to use Linux for the process both ways, the whole process becomes a bit simpler, as no file is needed for the "corruption". There are two options, depending on how pressed your storage is for space. Near as I can tell there's no significant difference in speed between the options.
One option is to pad the beginning of the video file with random bytes of a full block size. A reasonable block size could be 4096, same as used for ISO files anyway.
The second option is to add a single byte to the beginning of the file. That should be enough to make it non-playable, and take the least additional space for the new file.
Option 1, full block of random bytes:
# Corrupting the video file
dd if=/dev/random of=LockedVideo.mkv bs=4096 count=1
dd if=MyVideo.mp4 of=LockedVideo.mp4 bs=4096 conv=notrunc seek=1
# Cleaning the video file for playing
dd if=LockedVideo.mp4 of=MyNewVideo.mp4 bs=4096 skip=1
Option 2, single byte added to beginning
# Corrupting the video file
dd if=MyVideo.mp4 of=LockedVideo.mp4 bs=4096 oflag=seek_bytes seek=1
# Cleaning the video file for playing
dd if=LockedVideo.mp4 of=MyNewVideo.mp4 bs=4096 iflag=skip_bytes skip=1
Last word
There is a very old implementation of dd
for Windows (Win32 environment), which may, or may not, be usable now. The options and workings "appear" to match the ancient Linux version, i.e.: no iflag=skip_bytes
, but the full block option above should work, if the program works. YMMV, however.