VideoHelp Forum




+ Reply to Thread
Results 1 to 12 of 12
  1. Member
    Join Date
    Aug 2015
    Location
    United States
    Search Comp PM
    Ok so I'm having a dilemma and I've been googling for hours trying to fix it, and have had no luck. I am attempting to batch convert raw .264 files from my Night Owl CCTV DVR system so that they can be played in any media player (WMP,VLC,REAL player ETC). The system records them in D1 if that means anything to anyone. I have a program that allows me to review these files, it was one I downloaded from Swann, but I send these CCTV files to many people for review, and it would be best, and simpler for everyone else, if I could batch convert them with ffmpeg into a more friendly format. I made an attempt at this with the following code but for some reason when they converted they played back way to fast, and I don't know enough about changing the code to fix the problem. I do not want to have to convert these files one at a time with an AVI converting tool, as I have 8+ hours of files to convert at any given time. And I have tried to use every converting program I could find and none of them recognize the CCTV file type enough to convert them to anything else. I am VERY novice within the world of video, so statements about " codec, or containers" goes way over my head!!!

    here is the ffmpeg code I attempted to use

    for %%a in ("*.*") do "C:\ffmpeg\ffmpeg" -i "%%a" -c:v libx264 -preset slow -crf 20 -c:a libvo_aacenc -b:a 128k "C:\newfiles\%%~na.avi"
    pause


    I found this code in a forum on another site from like 3 years ago. Any words of wisdom would be super fantastic!!!!
    Quote Quote  
  2. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    Sounds like the input video has a low framerate which is converted to i high(er) framerate. You need to figure out what framerate is used in the input video and then you must modify your command line to something like:

    for %%a in ("*.*") do "C:\ffmpeg\ffmpeg" -r IFR -i "%%a" -c:v libx264 -preset slow -crf 20 -c:a libvo_aacenc -b:a 128k -r OFR "C:\newfiles\%%~na.avi"

    where IFR is the input framerate used in the original files (.264) and OFR is the desired output framerate (try 30 or 29.970029).
    I'm the developer behind FFQueue. My posts might reflect this! ;-)
    Quote Quote  
  3. You should post a sample video

    Sometimes they are encrypted, and you won't be able to do anything

    If they truly are elementary .264 without a container, you need to specify that in the wildcard syntax *.264 , and use -f h264 before the input -i
    Quote Quote  
  4. Member
    Join Date
    Aug 2015
    Location
    United States
    Search Comp PM
    How would I go about determining what the input framerate is? I tried to upload a sample video, but it keeps telling me its an unsupported file type or something.
    Quote Quote  
  5. put it in a zip file (e.g. 7zip, winrar etc...) to upload
    Quote Quote  
  6. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    You should be able to get framerate with mediainfo or ffprobe (tool usually bundled with ffmpeg).
    I'm the developer behind FFQueue. My posts might reflect this! ;-)
    Quote Quote  
  7. Member
    Join Date
    Aug 2015
    Location
    United States
    Search Comp PM
    I used MediaInfo, and this is what it showed me under the Text View Tab:

    General
    Complete name : C:\Users\Stephanie\Desktop\ch00000000000001-150820-220904-221244-10p00001000000400.264
    Format : AVC
    Format/Info : Advanced Video Codec
    File size : 12.2 MiB

    Video
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Baseline@L3
    Format settings, CABAC : No
    Format settings, ReFrames : 2 frames
    Format settings, GOP : M=1, N=7
    Width : 704 pixels
    Height : 480 pixels
    Display aspect ratio : 3:2
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive




    And I believe I attached a zip file for an example of the video type I am trying to convert
    Quote Quote  
  8. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    If I take the file you posted (extracted and renamed to test.264) and use the following remux (no reencoding) command:

    ffmpeg -f h264 -r 6 -i test.264 -c:v copy -c:a copy test.mkv

    I get a working file with an almost perfekt framerate that plays with VLC. Using MP4 as container does for some reason not work.
    I'm the developer behind FFQueue. My posts might reflect this! ;-)
    Quote Quote  
  9. It's because of ffmpeg's buggy mp4 muxer . You can use mp4box, lsmash, or ffmbc instead

    A batch using ffmbc from a batch file would look something like this:

    You can change the input/output directories to whatever you want
    Code:
    for %%a in ("*.264") do ffmbc -r 6 -f h264 -i "%%a" -vcodec copy -an "%%~na.mp4"
    pause
    Quote Quote  
  10. Member
    Join Date
    Aug 2015
    Location
    United States
    Search Comp PM
    Which way would be best for batch converting 8rs worth of video clips at a time? I'm not real familiar with any of these programs(ffmpeg,mp4box,Ismash, or ffmbc), but will use what is advised. And what I need to do is be able to run the batch from a folder that moves the converted files to a folder on my c:newfiles. my ffmpeg program is on the c drive as well. Not to sound like a complete idiot...It would be awesome to have the exact code string that I can copy and paste to create the batch file, any guess work on my part will most definitely not work well
    Quote Quote  
  11. ffmbc is just a branch of ffmpeg. They are almost the same thing, but ffmbc is geared for more professional usage . You can download ffmbc.exe and put it in the c:\ directory, just like you have your ffmpeg.exe

    The batch file batch.bat (I zipped it up and attached below, but you can copy & paste the text below to a text file in notepad, rename the extension to .bat from .txt - that's how you make a batch file) needs to be unzipped and placed in the directory of files to be converted. Then double click batch.bat . The output files will be in c:\newfiles as you can see in the text below

    Code:
    for %%a in ("*.264") do "c:\ffmbc.exe" -r 6 -f h264 -i "%%a" -vcodec copy -an "c:\newfiles\%%~na.mp4"
    pause
    Image Attached Files
    Quote Quote  
  12. Member
    Join Date
    Aug 2015
    Location
    United States
    Search Comp PM
    Ok I downloaded ffmbc and downloaded the zip file. Thank you so much for your help!!!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!