VideoHelp Forum
+ Reply to Thread
Results 1 to 25 of 25
Thread
  1. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    I have a CCTV system that lets me back up the recordings as AVI (H264). Unfortunately, the format is not standard and I can't use the files in After Effects or Premiere. They also do not work correctly in Windows 10 Films & TV, VLC. Handbrake won't touch them and complains "No valid source of titles found". They do play with Windows 10 Windows Media Player and Kodi

    Avidemux does allow me to transcode them after initially complaining about "Malformed Header". I'd rather not add yet another transcode to my workflow if possible as the files are quite low quality to start with and the transcoded versions would take up too much space as there are many hours of recordings.

    I've contacted the manufacturers, but I'm not expecting anything back.

    avifixed, divfix, avirepair won't fix it.

    I really need to be able to get them to work directly with Adobe products, can anyone help?


    **I've included the file and details:**

    No audio was recorded

    CCTV Model: Zosi H.264 HD 1080P DVR - ZR04LN/10

    Filename: CH03-2018-02-25-14-12-57

    Dropbox: https://www.dropbox.com/s/v6odt6a5ggxvbew/CH03-2018-02-25-14-12-57.avi?dl=0 (~8mb)

    VirtualDub won't open it: https://forum.videohelp.com/images/imgfiles/MuzyCkj.png

    MediaInfo: https://forum.videohelp.com/images/imgfiles/zGb7O5d.png

    VideoInspector: https://forum.videohelp.com/images/imgfiles/uOTJOAD.png

    GSpot: https://forum.videohelp.com/images/imgfiles/o0Rg1S5.png

    VirtualDub: https://forum.videohelp.com/images/imgfiles/8XTrLcp.png https://forum.videohelp.com/images/imgfiles/f6A0h4x.png

    Avidemux: https://forum.videohelp.com/images/imgfiles/nZ0yBes.png
    Quote Quote  
  2. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    try remuxing it to an mp4 - copy video with aac audio(yes i know there is none) using avidemux - worked to get it into vegas.
    Image Attached Files
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  3. It opens directly in after effects cc and premiere cc for me . Perhaps you are using an older version ?
    Quote Quote  
  4. VirtualDub can open the video if you have the right source filters and VFW decoder. Or you can just use VirtualDub FilterMod which has such things built-in.

    As was pointed out, you can easily remux to MP4 or MKV, whatever your software accepts. You can do this with ffmpeg in a batch file. For example, put this in a batch file called Remux to MP4.bat:

    Code:
    "C:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "%~1" -vcodec copy -acodec copy -absf aac_adtstoasc "%~dpn1.mp4"
    Change the path to ffmpeg.exe if necessary on your computer. You can then drag/drop one of your source files onto the batch file to get an MP4 file. If you put that batch file in your SendTo folder you can right click on one of your AVI files and select Send To -> Remux to MP4.bat.
    Quote Quote  
  5. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by aedipuss View Post
    try remuxing it to an mp4 - copy video with aac audio(yes i know there is none) using avidemux - worked to get it into vegas.
    This worked wonderfully. I have no idea how I never tried this combo myself. Probably that I couldn't see the trees for the woods!.

    I wrote a batch script for this, which I don't know how to remove the "malformed header" warning.

    Thank you very much!!!!

    Code:
    set avidemux="C:\Program Files\Avidemux 2.7 - 64 bits\avidemux.exe"
    set videocodec=Copy
    set audiocodec=AAC (FDK)
    set outputformat=MP4
    for %%f in (*.avi) do %avidemux% --videoprocess false --video-codec %videocodec% --audio-codec %audiocodec% --output-format %outputformat% --force-alt-h264 --load "%%f" --save "%%f.mp4" --quit
    Quote Quote  
  6. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    It opens directly in after effects cc and premiere cc for me . Perhaps you are using an older version ?
    Yes, CC 2015 :/
    Quote Quote  
  7. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    interestingly enough even though vegas pro14 wouldn't open the avi file, premiere pro cs6 imports it without a problem.

    Image
    [Attachment 44779 - Click to enlarge]
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  8. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    It seems the video is also variable frame rate, which is causing havoc with audio sync issues.
    So it looks like I'll have to transcode too, meaning a re-compression of the video losing quality.. /sigh.
    What are the best options for this in Avidemux to preserve quality? Again I can't go to a large intermediary format.
    Quote Quote  
  9. Originally Posted by ziplock9000 View Post
    I'll have to transcode too, meaning a re-compression of the video losing quality
    Use a lossless codec and you won't lose any quality.
    Quote Quote  
  10. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by ziplock9000 View Post
    I'll have to transcode too, meaning a re-compression of the video losing quality
    Use a lossless codec and you won't lose any quality.
    As I mentioned, because this is CCTV footage with a huge amount of files *and* will be a frequent event, making the number of files even more. We simply do not have the storage for HQ intermediary files, nevermind lossless files. I'd like to transcode to a very similar format to the source, without losing much at all if possible. In my mind, many of the frames will be exactly the same so some sort of copy or passthrough for those that are not being changed due to the timing of VBR to CBR conversion.
    Quote Quote  
  11. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    everything i open the avi with says it's cfr 29.97. what says different? and what audio? there is none in the avi you uploaded.
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  12. AVI does not support VFR . You must be referring to the re-wrapped file in MP4 container, there are probably errors with the timecodes

    It opens up in AE CC 2015 as well for me, and aedipuss imported it into PP CS6 .... are you on Windows version of Adobe ?
    Quote Quote  
  13. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by aedipuss View Post
    everything i open the avi with says it's cfr 29.97. what says different? and what audio? there is none in the avi you uploaded.
    The audio was recorded externally with a DR-05 48Khz. Sorry, I should have said that.
    Quote Quote  
  14. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    AVI does not support VFR . You must be referring to the re-wrapped file in MP4 container, there are probably errors with the timecodes

    It opens up in AE CC 2015 as well for me, and aedipuss imported it into PP CS6 .... are you on Windows version of Adobe ?
    Yes, correct. The mp4 conversion:
    Image
    [Attachment 44784 - Click to enlarge]


    They open up in Adobe on windows yes, but they are VFR so the audio goes out of sync from an externally record from a DR-05 @ 48khz
    Quote Quote  
  15. Originally Posted by ziplock9000 View Post

    The audio was recorded externally with a DR-05 48Khz. Sorry, I should have said that.


    External audio can be problematic, unless you have genlock or some method of running off the same clock . You almost always have some drift on longer recordings.

    But that's probably an additional issue . I'm just wondering why it doesn't import correctly in your version of Adobe
    Quote Quote  
  16. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    have you updated your pp cc 2015? hard to believe cs6 can open and use the avi and cc can't.
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  17. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by ziplock9000 View Post

    The audio was recorded externally with a DR-05 48Khz. Sorry, I should have said that.


    External audio can be problematic, unless you have genlock or some method of running off the same clock . You almost always have some drift on longer recordings.

    But that's probably an additional issue . I'm just wondering why it doesn't import correctly in your version of Adobe
    It might sound very hacky, but is there no way to manually adjust the synchronisation of the sound at the start of the clip, then separately at the end of the clip and have it interpolate the time of the audio inbetween?
    Quote Quote  
  18. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by aedipuss View Post
    have you updated your pp cc 2015? hard to believe cs6 can open and use the avi and cc can't.
    Nope and I'd be castrated by the team if I tried to update. With the mp4's working just fine in Adobe, the AVI problem is gone.. All that remains is the VFR to CFR conversion so that external audio syncs up.

    Maybe i should have made another thread.
    Quote Quote  
  19. Originally Posted by ziplock9000 View Post

    It might sound very hacky, but is there no way to manually adjust the synchronisation of the sound at the start of the clip, then separately at the end of the clip and have it interpolate
    the time of the audio inbetween?
    Usually not that easily. If you're lucky it might work ok; but usually drift means there is some progressive sync issue . You have to stretch or shrink either the audio or video to match. Unfortunately that' s only if it's entirely linear. Most often it's not. You end up having to manually edit and sync up sections. ughhh!

    Short clips usually don't have a problem . If you have long recordings ,you're likely in trouble . I'm guessing the CCTV usage scenario is going to be long clips...


    Right now, I think it would be a better starting point with the AVI . Even if that has sync drift , that's not going to be compounded by your timecode errors.


    But there is something buggy about your AVI which might be the cause of the MP4 timecode errors - how was it processed ? Was recording abruptly stopped, power outage, or some form of cutting used ?
    Quote Quote  
  20. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by ziplock9000 View Post

    It might sound very hacky, but is there no way to manually adjust the synchronisation of the sound at the start of the clip, then separately at the end of the clip and have it interpolate
    the time of the audio inbetween?
    Usually not that easily. If you're lucky it might work ok; but usually drift means there is some progressive sync issue . You have to stretch or shrink either the audio or video to match. Unfortunately that' s only if it's entirely linear. Most often it's not. You end up having to manually edit and sync up sections. ughhh!

    Short clips usually don't have a problem . If you have long recordings ,you're likely in trouble . I'm guessing the CCTV usage scenario is going to be long clips...


    Right now, I think it would be a better starting point with the AVI . Even if that has sync drift , that's not going to be compounded by your timecode errors.


    But there is something buggy about your AVI which might be the cause of the MP4 timecode errors - how was it processed ? Was recording abruptly stopped, power outage, or some form of cutting used ?
    I was afraid the timing would be non-linear. You're also correct that the files contain hours of video.
    The AVIs are created by using the "backup" feature of the CCTV which seem to have a non-standard format.
    I've no idea how the conversion process outlined near the top of the thread has made the AVI (which are CFR) become VFR when changed to MP4s
    I have a feeling that they were always VFR/MP4 and that the CCTV incorrectly just dumps them into an AVI container, but that's a guess.

    I used Avidemux with the following settings:
    Video Output : Copy
    Audio Output : AAC (FDK)
    Output Format: MP4 Muxer

    Everything else just defaults.
    I just manually converted one again and it's changed to VFR.
    Quote Quote  
  21. gspot reports error in your AVI "bad chunk in frame data: invalid length" - I was wondering if it was representative of an AVI you pull off the machine. Do all of them act like this ? Or did you process it , or cut it, or edit it in some way ?

    There are some discrepancies between the actual coded frames and the timing information. That's probably why the re-wrapped MP4 is VFR .

    gspot reports 1410frames and 47.047sec duration
    mediainfo reports 1388frames and 46.313sec duration
    media players like mpchc, potplayer report 1min 3sec duration
    elementary stream only has 694 frames, unless there are errors in demuxing the video stream . But this would only be ~23seconds at 29.97 fps

    all this conflicting data, none of them correlate. Very buggy AVI.



    When you import the AVI directly into PP ,it actually gets converted to CFR , with duplicates, to keep the 29.97 timing . I keep an older version of AE CC2015 (because of some compatibility issues with some scripts and plugins) , and that imports the AVI as well
    Quote Quote  
  22. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    gspot reports error in your AVI "bad chunk in frame data: invalid length" - I was wondering if it was representative of an AVI you pull off the machine. Do all of them act like this ? Or did you process it , or cut it, or edit it in some way ?

    There are some discrepancies between the actual coded frames and the timing information. That's probably why the re-wrapped MP4 is VFR .

    gspot reports 1410frames and 47.047sec duration
    mediainfo reports 1388frames and 46.313sec duration
    media players like mpchc, potplayer report 1min 3sec duration
    elementary stream only has 694 frames, unless there are errors in demuxing the video stream . But this would only be ~23seconds at 29.97 fps

    all this conflicting data, none of them correlation. Very buggy AVI.



    When you import the AVI directly into PP ,it actually gets converted to CFR , with duplicates, to keep the 29.97 timing . I keep an older version of AE CC2015 (because of some compatibility issues with some scripts and plugins) , and that imports the AVI as well
    Yes they all have that error, it's "normal" for that system. It could be a side effect of the CCTV's internal conversion from it's internal format to AVI for backups.. I have no control over that.

    I've just tried importing one of the source AVIs into PP CC 2015 again and always get this error:

    Image
    [Attachment 44785 - Click to enlarge]


    I'm using APP CC 2015.0 9.0.0. (247) Build.
    Quote Quote  
  23. Have you tried installing a VFW h.264 decoder? Maybe your programs will open the original AVI file with that.
    Quote Quote  
  24. Member
    Join Date
    Feb 2018
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by jagabo View Post
    Have you tried installing a VFW h.264 decoder? Maybe your programs will open the original AVI file with that.
    I installed x264vfw which allowed me to import the AVIs directly into PP without needing to convert them into mp4's.

    I also had to interpret the footage as 29.97. Which made the framerate correct and the length correct.
    A whole ~8h sequence made from ~30 files is 3 seconds longer than the same sequence converted from ~30 AVI->MP4.
    So I wonder if that now contains the extra frames that were missing that caused the audio sync issue?
    I'll have to test this further thanks.
    Quote Quote  
  25. AVI doesn't support variable frame rates. So the length of the AVI file(s) is probably the correct length. AVI has a specific "duplicate" frame type that can be used for exact duplicate frames (your AVI has lots of them). When those are muxed into MP4 the duplicate frames aren't included, the time code of the previous frame is just extended -- making the MP4 VFR.
    Quote Quote  



Similar Threads

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