VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    I am new to FFMPEG, and would like to ask for your help understanding the basics.

    I am trying to join AVI files (codec = MJPEG, taken by digital cameras) losslessly using FFMPEG Concatenate function. It seems the joining works (the joined video plays), but when I ran CONCAT function, I get (error) messages showing "[avi @ 0xxxxxxxxxxxxx] non-interleaved AVI". This message is often accompanied by a message, "mono audio is assumed" or "stereo audio is assumed" (but not always).

    The resulting file appears to be OK (it plays). However, the resulting file size is not exactly the same as the combination. For example, when I joined two 100MG files, I get 210MB (just a hypothetical example).

    Is this a normal behavior? Is it something I can safely ignore?

    If it is an error, how can I solve this?

    Thank you very much for your advice.
    Last edited by giroro; 25th Feb 2020 at 10:56.
    Quote Quote  
  2. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    Here is the actual output:
    =========

    ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9.2.1 (GCC) 20200122
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    libavutil 56. 31.100 / 56. 31.100
    libavcodec 58. 54.100 / 58. 54.100
    libavformat 58. 29.100 / 58. 29.100
    libavdevice 58. 8.100 / 58. 8.100
    libavfilter 7. 57.100 / 7. 57.100
    libswscale 5. 5.100 / 5. 5.100
    libswresample 3. 5.100 / 3. 5.100
    libpostproc 55. 5.100 / 55. 5.100
    Guessed Channel Layout for Input Stream #0.1 : mono
    Input #0, concat, from 'mylist.txt':
    Duration: N/A, start: 0.000000, bitrate: 24709 kb/s
    Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], 24453 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
    Output #0, avi, to 'output.avi':
    Metadata:
    ISFT : Lavf58.29.100
    Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 72:72 DAR 16:9], q=2-31, 24453 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [avi @ 0000029e9c6329c0] non-interleaved AVIime=00:01:29.46 bitrate=24683.8kbits/s speed= 2x
    frame= 4676 fps= 33 q=-1.0 size= 492554kB time=00:02:48.96 bitrate=23880.5kbits/s speed=1.18x
    Quote Quote  
  3. You have to check if all avi files have the same resolution (pe 1280x720), interleaved or porgressive, the same audio tracks (pe aac 128k, stereo) for flawless concat working.
    Quote Quote  
  4. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    Thank you for your reply. They are taken by the same camera with exactly the same setting. Thus, the settings should be the same. What I would like to know is the meaning of "non-interleaved" and whether it should be considered an error.

    Thanks.
    Quote Quote  
  5. "Interleaved" means the video and audio are interleaved.
    ie some frames of video, then some audio, then more frames of video and so on....
    My understanding is non-interleaved means the AVI would contain all the video frames in succession and then all the audio. Interleaving is used because it makes seeking much faster and the player doesn't need to jump back and forth in the file to decode it.
    AVI = Audio Video Interleave.

    I don't know if ffmpeg is telling you the input is non-interleaved or if it's the output, although interleaving requires a bit more "overhead" so if the file size has grown it suggests the input was non-interleaved but the output is interleaved.

    You can join AVIs with VirtualDubMod or VirtualDub2 and control the interleaving. You'd open an AVI and use the "File/Append Segment" menu to append another AVI to the open one(s). You can also edit before resaving if you desire. When saving the new AVI you need to select "Direct Stream Copy" under the video menu so VirtualDubMod/2 won't want to re-encode.

    To control the interleaving with VirtualDubMod you use the "Streams/Stream List" menu and then right click on the audio stream in the window that opens and select Interleaving. For VirtualDub2 it's Audio/Interleaving. You can also set an audio delay to sync the audio to the video if need be. The main advantage of the old VirtualDubMod is it allows adding more than one audio stream. It looks like VirtualDub2 is still limited to a single stream. Either way, the interleaving window looks like the screenshot below. The defaults are fine, although I used to change the interleaving to every two frames as it reduces the file size a tad, and because that's the way AutoGK interleaved the audio. I think the interleaving option is ignored when the audio is variable bitrate and VirtualDubMod/2 does it's own thing anyway.

    If you're worried, try VirtualDubMod/2 to see if the result is any different.

    PS. If VirtualDubMod complains about not having the required codec (it needs a video for windows codec to decode and display a preview) you should still be able to append and resave AVIs, but without being able to preview them. If you don't have the required codec VirtualDub2 might try to open the AVI using a method that prevents direct stream copy of the video. I'm not sure, but if so try selecting "Audio/Video Interleave" as the file type in the window for opening files to prevent it opening the AVI a different way.
    Image Attached Images  
    Last edited by hello_hello; 26th Feb 2020 at 09:56.
    Quote Quote  
  6. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    Dear hellox2:

    Thank you for your explanation. This is really helpful. I will definitely try VirtualDubMod and VD2, and see how it goes.

    I also gather that non-interleaved messages generated by FFMPEG does not indicate there are errors in the CONCAT process. It just means that FFMPEG "interleaved" some frames in the output. Thus it is something I can safely disregard as far as I can live with the slightly increased file size. Is this a correct understanding?

    Thank you so much.
    Quote Quote  
  7. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    Dear Hello_Hello:

    I merged them using VirtualDub2. The resulting file size is almost identical to the size of the one merged with FFMPEG. The combined file should be 3.47GB (the simple sum of the two files), but the size of the video created by FFMPEG is 3.58GB and the one created by VirtualDub2 is 3.54GB. It seems this small difference was caused by the idiosyncrasy of each program.

    I don't care about this small size difference as far as there is the message--"non-interleaved AVI"--is not an error that could affect the quality of the joined video file. It appears it is not.

    Thank you for your help.
    Quote Quote  
  8. You're welcome.

    Even if it's non-interleaved I don't see how it could effect the quality of the file as such. You can always experiment by unchecking "enable audio/video interleaving" in VirtualDub2, which should save the output as non-interleaved. Interleaved is preferable, but if the output size is similar to the combined AVI sizes, then I guess the source AVIs are non-interleaved. You can do a similar thing with the individual AVIs without joining them to see how interleaved/non-interleaved effects their individual file sizes.
    Quote Quote  
  9. It occurred to me that MediaInfo might display some info about how am AVI is interleaved. It does, although I'm not completely sure how to interpret it yet. This is MediaInfo's display in HTML mode. The source was a small mjpeg AVI containing 455 frames (roughly 15 seconds) and the output files saved with VirtualDub Mod. Maybe there's a limit to how non-interleaved an AVI can be?

    Screenshot #1 is the original.
    #2 is with interleaving disabled.
    #3 is the VirtualDubMod default interleaving.
    #4 is after specifying interleaving of 15000ms (lossy audio has frames but I don't know how the "frames" interleaving option would be interpreted for PCM)
    Image Attached Thumbnails Click image for larger version

Name:	1.gif
Views:	98
Size:	5.7 KB
ID:	52168  

    Click image for larger version

Name:	2.gif
Views:	105
Size:	5.4 KB
ID:	52169  

    Click image for larger version

Name:	3.gif
Views:	66
Size:	5.7 KB
ID:	52170  

    Click image for larger version

Name:	4.gif
Views:	98
Size:	5.7 KB
ID:	52171  

    Quote Quote  
  10. Member
    Join Date
    Sep 2013
    Location
    Singapore
    Search PM
    Hello_Hello,

    Thank you again for your advice. I did some experiment. I tested with a 270,600KB MPJEG file. When I checked the "interleaved" option, the direct streamed copy file size was 270,520KB. When I didn't interleave, the direct streamed copy file size was 270,256KB.

    So, the file size changes slightly. But I guess this is normal, and it is due to how VirtualDub handles the direct stream copy function.

    Now I can join all my MJPEG files with a peace of mind! Many thanks.

    Best wishes,
    Jay
    Quote Quote  



Similar Threads

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