F4F is Adobe’s fragmented MP4 file format for HTTP Dynamic Streaming.
Check out this video converter
To save the video we will use the fact that the browser has to download to temp the video and will do so in f4f format.
1. First download and run CCleaner – run it click Analyze then right click on Firefox – Internet Cache and select Clean. (it will ask to close firefox to analyze it in the first place)
3. Download VideoCacheView
2. Open the video you want to download and let it play from start to finish. Close firefox and open VideoCacheView (must first close firefox to be able to access the video fragments)
-Sort by Last Accesedd Date and you will se in the download someurl.mp4Seg1-Frag1 Frag2 etc
Select all the fragments and save them to a folder.
Then export first column with the name of the filenames of the fragments to a.csv and save it in the same folder with the fragments.
Now all we need to do is combine the fragments and get the original video.
Install php as explained in this post : Install PHP in windows to run from cmd
Run the next script in the same folder with the video fragments.
Press SHIFT and then right click on the folder – select – Open command window here.
<?php
function ReadInt24($str, $pos)
{
return intval(bin2hex(substr($str, $pos, 3)), 16);
}
function ReadInt32($str, $pos)
{
return unpack(“N”, substr($str, $pos, 4))[1];
}echo “\nKSV Adobe HDS Downloader\n\n”;
$flvHeader = hex2bin(“464c5601050000000900000000”);
$firstVideoPacket = true;
$prevTagSize = 4;
$fragCount = 0;
$outputFile = “Joined.flv”;
$flv = fopen(“$outputFile”, “wb”);
fwrite($flv, $flvHeader, 13);
// here read filenames
$csv = array_map(‘str_getcsv’, file(‘a.csv’));
echo “Found $fragCount fragments\n”;
foreach($csv as $file)
{
$frag = file_get_contents($file[0]);
preg_match(‘/(.{4})mdat[\x08\x09\x12]/i’, $frag, $mdat, PREG_OFFSET_CAPTURE);
$fragLen = ReadInt32($mdat[1][0], 0) – 8;
$frag = substr($frag, $mdat[1][1] + 8, $fragLen);
$pos = 0;
while ($pos < $fragLen)
{
$packetType = $frag[$pos];
$packetSize = ReadInt24($frag, $pos + 1);
$packetTS = ReadInt24($frag, $pos + 4);
$totalTagLen = 11 + $packetSize + $prevTagSize;
if (($packetType == “\x08” && $packetSize > 4) or ($packetType == “\x09” && $packetSize > 40) or ($packetType == “\x09” && $firstVideoPacket))
{
if ($packetType == “\x09” && $firstVideoPacket)
$firstVideoPacket = false;
fwrite($flv, substr($frag, $pos, $totalTagLen), $totalTagLen);
}
$pos += $totalTagLen;
}
}
fclose($flv);
echo “Finished\n”;
?>
and press ENTER.
Write : php join_f4f_to_flv.php
Befor running the command copy the following code in a file named join_f4f_to_flv.php in the same folder :
Finally you can use any software to convert the .flv file to any desired format.
Please leave a comment with a url with f4f steaming so I can improve the script/method as I can’t seem to find some content to practice.