Author Topic: audio - unknown codec  (Read 322 times)

Erik_P

  • Newbie
  • *
  • Posts: 3
audio - unknown codec
« on: January 09, 2019, 05:54:26 PM »
AviDemix 2.7 (64 bit Windows) does not recognize the audio codec.
Audio Output in AviDemux was set to 'copy'.

I have uploaded a sample file:
https://we.tl/t-VI4cAMfQzC

Help would be appreciated.

Thx
Erik_P

dosdan

  • Full Member
  • ***
  • Posts: 131
Re: audio - unknown codec
« Reply #1 on: January 09, 2019, 07:50:41 PM »
I tried this with the Win64 190108 nightly build.  File | Information reports that the audio code is "unknown'.

MediaInfo has the audio stream as PCM Little/Signed and 24-bit.

FFPROBE also reports it as 24-bit audio, which I'm sure ADM doesn't support. (It's supposed to be a simple program, not all-encompassing):

Stream #0:1: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s32 (24 bit), 2304 kb/s


Perhaps a warning message about this should be shown in ADM when this type of clip is loaded?

Dan.
« Last Edit: January 09, 2019, 08:06:14 PM by dosdan »

Erik_P

  • Newbie
  • *
  • Posts: 3
Re: audio - unknown codec
« Reply #2 on: January 10, 2019, 02:03:48 PM »
Thx for your feedback.
I conclude that AviDemux will not support this type of avi-files, or more specifically this audio codec.

Erik_P

dosdan

  • Full Member
  • ***
  • Posts: 131
Re: audio - unknown codec
« Reply #3 on: January 10, 2019, 07:49:19 PM »
I conclude that AviDemux will not support this type of avi-files, or more specifically this audio codec.

It supports Signed (S) 16-bit Little Endian (LE) PCM, but not the 24-bit version. To edit it in ADM, first use FFMPEG (https://ffmpeg.zeranoe.com/builds/) to convert the audio stream inside the AVI to S16LE PCM: 

ffmpeg -i "sample file.avi" -c:v copy -c:a pcm_s16le -ar 48000 "sample file (16-bit version).avi" 

Double inverted commas are needed around the filenames if they contain a space.

Note: -ar 48000  does not appear to be necessary. FFMPEG preserved the original audio stream's 48KHz sampling rate without including this parameter in the FFMPEG command line:

ffmpeg -i "sample file.avi" -c:v copy -c:a pcm_s16le "sample file (16-bit version).avi" 


Here's the converted AVI. It plays OK in ADM. The video stream has just been copied, so there is no video quality loss. This type of operation is very quick.

https://dl.dropbox.com/s/imtbi45eur01wgd/sample%20file%20%2816-bit%20version%29.avi

If you need to convert a lot of these 24-bit clips, it's not hard to make a batchfile for this and just drop-and-drop one or more files to be converted on to this batchfile's icon on the Windows desktop.

Dan.
« Last Edit: January 10, 2019, 08:28:21 PM by dosdan »

dosdan

  • Full Member
  • ***
  • Posts: 131
Re: audio - unknown codec
« Reply #4 on: January 10, 2019, 09:19:58 PM »
If you need to convert a lot of these 24-bit clips, it's not hard to make a batchfile for this and just drop-and-drop one or more files to be converted on to this batchfile's icon on the Windows desktop.

Here's Find_Convert_24-bit_PCM_to_16-bit.bat which uses both ffprobe and ffmpeg:

Code: [Select]
@echo off
cls
if not exist "%%~dpFconverted\" md "%%~dpFconverted\
for %%F in (%*) do (
  ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 "%%~dpnxF" | find "pcm_s24le">nul && ffmpeg -i "%%~dpnxF" -hide_banner -v error -y -c:v copy -c:a pcm_s16le "%%~dpFconverted\%%~nF.avi" && echo The 24-bit PCM audio stream in "%%~dpnxF" was converted to 16-bit PCM and the new AVI placed in "%%~dpFconverted"
shift
)
pause

I didn't have any other AVIs with 24-bit audio, so I copied/renamed your original 24-bit file and my converted (16-bit) version 3 times, including names with spaces and parentheses to test the parsing accuracy of the batchfile. Here's the batchfile, with "D:\" in front since the batchfile is not situating in the current directory or in a directory in the PATH list. I'm running it from the command line here so I can intersperse the AVIs filenames to test that it ignores the 16-bit versions without stopping. If a "converted" sub-directory does not exist below the current directory, it's first created, and the converted files end up there.

The display at the command prompt:

Code: [Select]
C:\Users\Dan\Downloads>d:\Find_Convert_24-bit_PCM_to_16-bit.bat 24_1.avi 16_1.avi "24 2.avi" "16 2.avi" "24 (3).avi" "16 (3).avi"


The 24-bit PCM audio stream in "C:\Users\Dan\Downloads\24_1.avi" was converted to 16-bit PCM and the new AVI placed in "C:\Users\Dan\Downloads\converted"
The 24-bit PCM audio stream in "C:\Users\Dan\Downloads\24 2.avi" was converted to 16-bit PCM and the new AVI placed in "C:\Users\Dan\Downloads\converted"
The 24-bit PCM audio stream in "C:\Users\Dan\Downloads\24 (3).avi" was converted to 16-bit PCM and the new AVI placed in "C:\Users\Dan\Downloads\converted"
Press any key to continue . . .


It would also be possible to delete each of the original 24-bit files once it was successfully converted. Also the converted files could be kept in the original directory and their filenames altered to indicate that they are converted versions.

Dan.
« Last Edit: January 11, 2019, 08:51:59 PM by dosdan »

Erik_P

  • Newbie
  • *
  • Posts: 3
Re: audio - unknown codec
« Reply #5 on: January 12, 2019, 11:17:16 PM »
That helps.
Thanks for proposing a solution.

Erik_P