Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any good programs for handling f4f fragments and converting them into a complete video? [closed]

I'm trying to download a video from a site. Unfortunately they stream it as "fractions" of the f4f kind, and my usual program "Download Helper" (extension for Firefox) just present me with a endless and growing list of fragments.

So are there any good programs for

  • Downloading f4f fragments from a streamed video (eg. saving them as 0001, 0002, 0003, etc)
  • Stitching saved f4f fragments together into one video-file

I guess it would be best if the downloader was an extension for the browser (Firefox or Chrome). It would be great if both functions (downloading and "stitching") was in the same program (browser-extension).

like image 511
Baard Kopperud Avatar asked Aug 21 '14 12:08

Baard Kopperud


3 Answers

What you are seeking is here : https://github.com/K-S-V/Scripts/blob/master/AdobeHDS.php

git clone https://github.com/K-S-V/Scripts.git

this will provide you Script/AdobeHDS.php

( from time to time you might xant to do a git pull to get latest version ).

you can launch the script directly with a manifest file ( up to you to find documentation... some hint there : http://forum.videohelp.com/threads/342430-F4F-capturing-converting

  • a very basic a linux script :
#!/bin/bash

FIRST=1

# ( no real sample provided, up to you to find one )
URL_PREFIX=http://video-1-123.rutube.ru/hdsv2/Hq_BCp3Ohmd5dRp4DmgH5w/1411307589/7/n10vol1/a84bc722fed94812aa61f1b71510e953.mp4Seg1-Frag

while [[ $# > 0 ]]
do
    case $1 in
  first=*)
  FIRST=${1//first=/}
  ;;
  url=*)
  URL_PREFIX=${1//url=/}
  ;;
  name=*)
  NAME=${1//name=/}
  ;;
  *)
  echo "[ERROR] Unrecognized option '$1'"
  exit 1
  ;;
    esac
    shift 1
done

if [[ $URL_PREFIX =~ http://([^/]*/)*(.*) ]]
then
    echo "short : ${BASH_REMATCH[1]} ${BASH_REMATCH[2]}"
    SHORT_PREFIX=${BASH_REMATCH[2]}
fi



declare -i FRAG
FRAG=$FIRST

OK=0
while [[ $OK == 0 ]]
do
if [[ -f ${SHORT_PREFIX}${FRAG} ]]
then
    echo " Fragment #$FRAG already downloaded, on disk"
else
    wget ${URL_PREFIX}${FRAG}
    OK=$?
fi
FRAG=$(( $FRAG + 1 ))
done

if [[ -f $SHORT_PREFIX.flv ]]
then
    echo "$SHORT_PREFIX.flv already exists move it away if you want to restart a download + reassembly"
else
# should extract name from url.
    php Scripts/AdobeHDS.php --fragments $SHORT_PREFIX
fi

if [[ -n $NAME ]]
then
    echo "renaming $SHORT_PREFIX.flv to $NAME.flv"
    mv $SHORT_PREFIX.flv "$NAME.flv"
fi

launch it with ./getfrag.sh url=(url of first fragment without the ending 1) name=(the name you want to rename the final flv file to)

... and hope.

Same topic under SO : How to convert F4F file to MP4?

like image 93
philippe lhardy Avatar answered Jan 19 '23 09:01

philippe lhardy


I use the KSV script philippe mentions, but with the HDS Link Detector add on for FireFox. I let the add on generate the proper command to give the script, paste it into the console, and run the script this way.

I do this in windows. Installing and configuring PHP (5.6.3) didn't take much time, but ran into a little snag with a php_curl.dll issue.

Since I'm not using php for anything else, I worked around this snag by simply creating a c:\php directory and copying and pasting the %PHP_HOME%/ext/php_curl.dll into c:\php. Note, for convenience, I created a PHP_HOME environment variable and set it to my php installation directory.

like image 39
Michael Szczepaniak Avatar answered Jan 19 '23 10:01

Michael Szczepaniak


To build a bit upon the answer regarding AdobeHDS.php + HDS Link Detector Firefox add-on, I've found that I for some videos get an access error related to downloading the add-on-detected manifest:

Processing manifest info.... Access Denied! Unable to download the manifest.

This can be solved by detecting the URL of the fragments via URL Snooper and then batch-downloading them via the Firefox add-on DownThemAll!. Then finally you can join all the fragments via AdobeHDS.php.

Example:

  1. Open URL Snooper, filter on Seg1-Frag since file fragments usually follow the Seg1-Frag[i] structure where i represents a number equal or greater than 1. Push the Sniff Network button, and start playing the streaming video on your browser. Back in URL Snooper, copy the URL of a detected fragment up to ..Seg1-Frag. For example:

    examplesite.net/programs/series/t6/c264,,.mp4.csmil/nameofvideo_Seg1-Frag

  2. Next, in Firefox go to: Tools -> DownThemAll! Tools -> Manager. Push the + button in the upper left corner, paste the previously copied URL into the Download field, and then add a range-estimate of the number of fragments (say [1:2000]) at the end of the URL. For example:

    examplesite.net/programs/series/t6/c264,,.mp4.csmil/nameofvideo_Seg1-Frag[1:2000]

    Then push: Start! -> Download Batch.

  3. Finally, merge all the fragments via AdobeHDS.php:

    php AdobeHDS.php --fragments nameofvideo_Seg1-Frag

like image 21
dash9483 Avatar answered Jan 19 '23 09:01

dash9483