List files that are not H264 encoded

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















I want to convert any files in a large media collection that are not encoded with H264. In order to do that I need a tool to list all the files, I need to convert. There are a lot of files to go through. The search needs to be recursive as files are stored in the following format /media/tv shows/show name/season 01/filename.extension










share|improve this question






















  • What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

    – kemotep
    Jan 12 at 21:55











  • @kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

    – cheesemarathon
    Jan 14 at 18:38











  • So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

    – kemotep
    Jan 14 at 19:19











  • Exactly @kemotep!

    – cheesemarathon
    Jan 16 at 9:34











  • I think I can have a script for you later today.

    – kemotep
    Jan 16 at 11:46















0















I want to convert any files in a large media collection that are not encoded with H264. In order to do that I need a tool to list all the files, I need to convert. There are a lot of files to go through. The search needs to be recursive as files are stored in the following format /media/tv shows/show name/season 01/filename.extension










share|improve this question






















  • What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

    – kemotep
    Jan 12 at 21:55











  • @kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

    – cheesemarathon
    Jan 14 at 18:38











  • So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

    – kemotep
    Jan 14 at 19:19











  • Exactly @kemotep!

    – cheesemarathon
    Jan 16 at 9:34











  • I think I can have a script for you later today.

    – kemotep
    Jan 16 at 11:46













0












0








0








I want to convert any files in a large media collection that are not encoded with H264. In order to do that I need a tool to list all the files, I need to convert. There are a lot of files to go through. The search needs to be recursive as files are stored in the following format /media/tv shows/show name/season 01/filename.extension










share|improve this question














I want to convert any files in a large media collection that are not encoded with H264. In order to do that I need a tool to list all the files, I need to convert. There are a lot of files to go through. The search needs to be recursive as files are stored in the following format /media/tv shows/show name/season 01/filename.extension







files video utilities






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 12 at 20:32









cheesemarathoncheesemarathon

31




31












  • What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

    – kemotep
    Jan 12 at 21:55











  • @kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

    – cheesemarathon
    Jan 14 at 18:38











  • So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

    – kemotep
    Jan 14 at 19:19











  • Exactly @kemotep!

    – cheesemarathon
    Jan 16 at 9:34











  • I think I can have a script for you later today.

    – kemotep
    Jan 16 at 11:46

















  • What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

    – kemotep
    Jan 12 at 21:55











  • @kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

    – cheesemarathon
    Jan 14 at 18:38











  • So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

    – kemotep
    Jan 14 at 19:19











  • Exactly @kemotep!

    – cheesemarathon
    Jan 16 at 9:34











  • I think I can have a script for you later today.

    – kemotep
    Jan 16 at 11:46
















What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

– kemotep
Jan 12 at 21:55





What have you tried so far and what are you having issues specifically implementing? Do you only need to list or sort out non-H264 encoded media files?

– kemotep
Jan 12 at 21:55













@kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

– cheesemarathon
Jan 14 at 18:38





@kemotep I have tried ffmpeg -i which tells me the video encoding but I'm not sure how to run that command on all files recursively but only return the file name if it's not encoded with h264.

– cheesemarathon
Jan 14 at 18:38













So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

– kemotep
Jan 14 at 19:19





So if I understand you correctly, you need to search through a large directory structure of video files, figure out what encoding the video files used, and then list the output (most likely to a file) of every instance of a file that does not use H264 encoding?

– kemotep
Jan 14 at 19:19













Exactly @kemotep!

– cheesemarathon
Jan 16 at 9:34





Exactly @kemotep!

– cheesemarathon
Jan 16 at 9:34













I think I can have a script for you later today.

– kemotep
Jan 16 at 11:46





I think I can have a script for you later today.

– kemotep
Jan 16 at 11:46










1 Answer
1






active

oldest

votes


















0














Here is what I have come up with so far. Note that this is a rough approximation of what you should do.



First, find all of your video files and output them to a file to be read, you can skip this part and just pipe the results to the next step.



find path/to/videos/directory -name *.mp4 >> /tmp/videoList.txt


This finds all .mp4 files in all the subfolders of your media directory and puts them in a file.



Next, you can use a tool as shown in this example to probe what encoding each video file uses. In this case we are looking for h264.



while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt


This example creates a file ,/tmp/h264List.txt, that has all the files that use h264 encoding. From here you can do a compare and find all of the non-h264 video files.



sort /tmp/videoFiles.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt


At this point you should have a file that has all of the non-h264 video files in the directories you searched in. All together it could look something like this:



Note that this is a rough example!



#!/bin/bash

find /home/user/videos/tvshows -name *.mp4 >> /tmp/videoList.txt

while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt

sort /tmp/videoList.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt

#Optional Cleanup, only if necessary
mv /tmp/nonh264List.txt /home/user/needToEncode.txt
rm /tmp/*.txt


Then from here you can do a similar loop through the needToEncode.txt file to run your desired ffmpeg encoding. You will need to change any paths to wherever your media is kept and the file extensions and encoding to whatever you are looking for.



I am going to include a link to the documentation for ffmpeg, as well as for mediainfo. You could also use the ffmpeg tool ffprobe as shown here to complete this task.



Please be sure to read through all links I have provided before attempting anything. This script may not be the most optimized or work exactly as you desire but I was able to use it to find all the video files, sort them, and save the output to a file.






share|improve this answer























  • This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

    – cheesemarathon
    Jan 18 at 11:01











  • @cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

    – kemotep
    Jan 18 at 12:02










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494153%2flist-files-that-are-not-h264-encoded%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Here is what I have come up with so far. Note that this is a rough approximation of what you should do.



First, find all of your video files and output them to a file to be read, you can skip this part and just pipe the results to the next step.



find path/to/videos/directory -name *.mp4 >> /tmp/videoList.txt


This finds all .mp4 files in all the subfolders of your media directory and puts them in a file.



Next, you can use a tool as shown in this example to probe what encoding each video file uses. In this case we are looking for h264.



while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt


This example creates a file ,/tmp/h264List.txt, that has all the files that use h264 encoding. From here you can do a compare and find all of the non-h264 video files.



sort /tmp/videoFiles.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt


At this point you should have a file that has all of the non-h264 video files in the directories you searched in. All together it could look something like this:



Note that this is a rough example!



#!/bin/bash

find /home/user/videos/tvshows -name *.mp4 >> /tmp/videoList.txt

while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt

sort /tmp/videoList.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt

#Optional Cleanup, only if necessary
mv /tmp/nonh264List.txt /home/user/needToEncode.txt
rm /tmp/*.txt


Then from here you can do a similar loop through the needToEncode.txt file to run your desired ffmpeg encoding. You will need to change any paths to wherever your media is kept and the file extensions and encoding to whatever you are looking for.



I am going to include a link to the documentation for ffmpeg, as well as for mediainfo. You could also use the ffmpeg tool ffprobe as shown here to complete this task.



Please be sure to read through all links I have provided before attempting anything. This script may not be the most optimized or work exactly as you desire but I was able to use it to find all the video files, sort them, and save the output to a file.






share|improve this answer























  • This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

    – cheesemarathon
    Jan 18 at 11:01











  • @cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

    – kemotep
    Jan 18 at 12:02















0














Here is what I have come up with so far. Note that this is a rough approximation of what you should do.



First, find all of your video files and output them to a file to be read, you can skip this part and just pipe the results to the next step.



find path/to/videos/directory -name *.mp4 >> /tmp/videoList.txt


This finds all .mp4 files in all the subfolders of your media directory and puts them in a file.



Next, you can use a tool as shown in this example to probe what encoding each video file uses. In this case we are looking for h264.



while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt


This example creates a file ,/tmp/h264List.txt, that has all the files that use h264 encoding. From here you can do a compare and find all of the non-h264 video files.



sort /tmp/videoFiles.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt


At this point you should have a file that has all of the non-h264 video files in the directories you searched in. All together it could look something like this:



Note that this is a rough example!



#!/bin/bash

find /home/user/videos/tvshows -name *.mp4 >> /tmp/videoList.txt

while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt

sort /tmp/videoList.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt

#Optional Cleanup, only if necessary
mv /tmp/nonh264List.txt /home/user/needToEncode.txt
rm /tmp/*.txt


Then from here you can do a similar loop through the needToEncode.txt file to run your desired ffmpeg encoding. You will need to change any paths to wherever your media is kept and the file extensions and encoding to whatever you are looking for.



I am going to include a link to the documentation for ffmpeg, as well as for mediainfo. You could also use the ffmpeg tool ffprobe as shown here to complete this task.



Please be sure to read through all links I have provided before attempting anything. This script may not be the most optimized or work exactly as you desire but I was able to use it to find all the video files, sort them, and save the output to a file.






share|improve this answer























  • This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

    – cheesemarathon
    Jan 18 at 11:01











  • @cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

    – kemotep
    Jan 18 at 12:02













0












0








0







Here is what I have come up with so far. Note that this is a rough approximation of what you should do.



First, find all of your video files and output them to a file to be read, you can skip this part and just pipe the results to the next step.



find path/to/videos/directory -name *.mp4 >> /tmp/videoList.txt


This finds all .mp4 files in all the subfolders of your media directory and puts them in a file.



Next, you can use a tool as shown in this example to probe what encoding each video file uses. In this case we are looking for h264.



while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt


This example creates a file ,/tmp/h264List.txt, that has all the files that use h264 encoding. From here you can do a compare and find all of the non-h264 video files.



sort /tmp/videoFiles.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt


At this point you should have a file that has all of the non-h264 video files in the directories you searched in. All together it could look something like this:



Note that this is a rough example!



#!/bin/bash

find /home/user/videos/tvshows -name *.mp4 >> /tmp/videoList.txt

while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt

sort /tmp/videoList.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt

#Optional Cleanup, only if necessary
mv /tmp/nonh264List.txt /home/user/needToEncode.txt
rm /tmp/*.txt


Then from here you can do a similar loop through the needToEncode.txt file to run your desired ffmpeg encoding. You will need to change any paths to wherever your media is kept and the file extensions and encoding to whatever you are looking for.



I am going to include a link to the documentation for ffmpeg, as well as for mediainfo. You could also use the ffmpeg tool ffprobe as shown here to complete this task.



Please be sure to read through all links I have provided before attempting anything. This script may not be the most optimized or work exactly as you desire but I was able to use it to find all the video files, sort them, and save the output to a file.






share|improve this answer













Here is what I have come up with so far. Note that this is a rough approximation of what you should do.



First, find all of your video files and output them to a file to be read, you can skip this part and just pipe the results to the next step.



find path/to/videos/directory -name *.mp4 >> /tmp/videoList.txt


This finds all .mp4 files in all the subfolders of your media directory and puts them in a file.



Next, you can use a tool as shown in this example to probe what encoding each video file uses. In this case we are looking for h264.



while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt


This example creates a file ,/tmp/h264List.txt, that has all the files that use h264 encoding. From here you can do a compare and find all of the non-h264 video files.



sort /tmp/videoFiles.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt


At this point you should have a file that has all of the non-h264 video files in the directories you searched in. All together it could look something like this:



Note that this is a rough example!



#!/bin/bash

find /home/user/videos/tvshows -name *.mp4 >> /tmp/videoList.txt

while read p; do
mediainfo $p | grep -v h264 | grep .mp4 |
cut -f2 -d: >> /tmp/h264List.txt
done </tmp/videoList.txt

sort /tmp/videoList.txt /tmp/h264List.txt | uniq -u >> /tmp/nonh264List.txt

#Optional Cleanup, only if necessary
mv /tmp/nonh264List.txt /home/user/needToEncode.txt
rm /tmp/*.txt


Then from here you can do a similar loop through the needToEncode.txt file to run your desired ffmpeg encoding. You will need to change any paths to wherever your media is kept and the file extensions and encoding to whatever you are looking for.



I am going to include a link to the documentation for ffmpeg, as well as for mediainfo. You could also use the ffmpeg tool ffprobe as shown here to complete this task.



Please be sure to read through all links I have provided before attempting anything. This script may not be the most optimized or work exactly as you desire but I was able to use it to find all the video files, sort them, and save the output to a file.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 16 at 20:49









kemotepkemotep

2,1713620




2,1713620












  • This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

    – cheesemarathon
    Jan 18 at 11:01











  • @cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

    – kemotep
    Jan 18 at 12:02

















  • This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

    – cheesemarathon
    Jan 18 at 11:01











  • @cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

    – kemotep
    Jan 18 at 12:02
















This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

– cheesemarathon
Jan 18 at 11:01





This is fantastic thank you! I have it working mostly but sometimes the codec will be AVC. AVC = H264, so how would I change your code to find both h264 and AVC?

– cheesemarathon
Jan 18 at 11:01













@cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

– kemotep
Jan 18 at 12:02





@cheesemarathon you can change the mediainfo query to look for AVC so that part would become something like: mediainfo $p | grep -v AVC | grep .mp4 | cut -f2 -d: >> /tmp/h264List You can grep for any type of file, just remember to change all instances of that file format or extension in the script. If you have a lot of different file formats and codecs that you need to sort through please edit your post to include all of the different things that need to be sorted.

– kemotep
Jan 18 at 12:02

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494153%2flist-files-that-are-not-h264-encoded%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay