5

I am trying to convert a MPEG4 video to AMV via ffmpeg. I've searched through web about the appropriate formatand and also tried to check another AMV video parametrs. So I've found that there should be bitrate for sound 22050 for sound with adpcm_ima_amv sound format, pixel format should be probably yuvj420p and the video size should be probably 160x120. So I've created a video with the same size and tried various types of commands, following at last:

ffmpeg.exe -i "c:\source160x120.mp4" -c:v amv -c:a adpcm_ima_amv -pix_fmt yuvj420p -vstrict -1 -s 160x120 -ar 22050 -b:a 40400 "c:\destination.amv"

However I am still getting following errors:

Only mono is supported Error initializing output stream 0:1 -- Error
while opening encoder for output stream #0:1 - maybe incorrect
parameters such as bit_rate, rate, width or height

I've also tried to change it to mono as following but there were just got even more errors:

ffmpeg.exe -i "c:\source160x120.mp4" -c:v amv -c:a adpcm_ima_amv -pix_fmt yuvj420p -vstrict -1 -s 160x120 -ar 22050 -b:a 40400 -af pan="mono| c0=FL" "c:\destination.amv"

The errors:

[Parsed_pan_0 @ 000002914a4d3cc0] Pure channel mapping detected: 0
[swscaler @ 000002914a60e9c0] deprecated pixel format used, make sure you did set range correctly
[amv @ 000002914a436c00] Invalid audio frame size. Got 1024, wanted 1378
[amv @ 000002914a436c00] Invalid audio block align. Got 520, wanted 697
[amv @ 000002914a436c00] Try -block_size 1378
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!

Do you know, what I am missing in the command or how I could make it work? I am quite new in ffmpeg.

Thanks for the help!

. . . . .

Btw: One AMV video that I tried to copy by ffmpeg to find out how it is made get following result during copying if it helps:

scale/rate is 0/0 which is invalid. (This file has been generated by broken software.) Last message repeated 1 times Guessed Channel Layout for Input Stream #0.1 : mono Input #0, avi, from '..\1.8_Test-2.amv': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: amv, yuvj420p(pc, bt470bg/unknown/unknown), 160x120, 16 fps, 16 tbr, 16 tbn, 16 tbc Stream #0:1: Audio: adpcm_ima_amv ([1][0][0][0] / 0x0001), 22050 Hz, mono, s16, 88 kb/s File 'test1.amv' already exists. Overwrite? [y/N] y Output #0, amv, to 'test1.amv': Metadata: encoder : Lavf58.76.100 Stream #0:0: Video: amv, yuvj420p(pc, bt470bg/unknown/unknown), 160x120, q=2-31, 16 fps, 16 tbr, 16 tbn, 16 tbc Stream #0:1: Audio: adpcm_ima_amv ([1][0][0][0] / 0x0001), 22050 Hz, mono, s16, 88 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [amv @ 0000021460f90800] Invalid audio packet size (698 != 697)rate= 40.4kbits/s speed=1.04e+04x Last message repeated 136 times frame= 992 fps=0.0 q=-1.0 Lsize= 5031kB time=00:01:02.00 bitrate= 664.7kbits/s speed= 122x video:4339kB audio:675kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.315401%

2 Answers2

3

Thanks for the quick help!

Your parameters worked so the video was converted, checked on the player that it was converted for and it looks like it works includin timing and all!

The command that was successfully used is following:

ffmpeg.exe -i "c:\input160x120.mp4" -c:v amv -c:a adpcm_ima_amv -pix_fmt yuvj420p -vstrict -1 -s 160x120 -ac 1 -ar 22050 -r 25 -block_size 882 "c:\output.amv"

2
ffmpeg -i input.mp4 -ac 1 -ar 22050 -r 25 -block_size 882 output.amv
  • Audio channel layout must be mono (-ac 1).
  • Audio sample rate must be 22050 (-ar 22050).
  • Frame rate must be divisible by the audio sample rate (22050). So frame rate (-r) can be 10, 14, 15, 18, 21, 25, 30, etc.
  • -block_size depends on frame rate. The console output will tell you what to use. Example message: Try -block_size 1378.
llogan
  • 63,280