Ubuntu – How to find all video files on the system

bashfile formatfilesfindvideo

I tried using the Unity Lens File search for *.* and filtering by Last Modified=All, Type=Videos, and Size=All but found nothing although I know there are some .3gp files in my Pictures folder. I know that I have numerous video files on another drive mounted on the file system as well. I compiled a list of likely extensions and I tried numerous iterations of the find command utilizing these with find ./ -name "*.ext" -o (etc, etc, ad nauseum) with no luck whatsoever. What is the solution?

Best Answer

  • Alternative: search on file:

    sudo find . -type f -exec file -N -i -- {} + | grep video
    

    or if you only want the filenames ...

    sudo find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'
    

    -N, --no-pad: Don't pad filenames

    -i, --mime: Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say 'text/plain; charset=us-ascii' rather than 'ASCII text'. In order for this option to work, file changes the way it handles files recognized by the command itself (such as many of the text file types, directories etc), and makes use of an alternative 'magic' file. (See the FILES section, below).


    The FILES section points to:

    Files

    /usr/share/misc/magic.mgc Default compiled list of magic.

    /usr/share/misc/magic Directory containing default magic files.


    file is slowwwwwwwwwwwwwwwww though (it will open all the files find finds) but has the advantage you do not need to add all those extentions.


    Using locate:

    locate *.mkv *.webm *.flv *.vob *.ogg *.ogv *.drc *gifv *.mng *.avi$ *.mov *.qt *.wmv *.yuv *.rm *.rmvb *.asf *.amv *.mp4$ *.m4v *.mp *.m?v *.svi *.3gp *.flv *.f4v