Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails audio problems ROR #209

Open
Davidzhu001 opened this issue Mar 21, 2020 · 2 comments
Open

Rails audio problems ROR #209

Davidzhu001 opened this issue Mar 21, 2020 · 2 comments

Comments

@Davidzhu001
Copy link

Davidzhu001 commented Mar 21, 2020

Hey guys, i have debug this for a long time and has no clue what happens

   apath = speech_evaluation_params[:attachment].tempfile.to_path
    audio =  FFMPEG::Movie.new(apath)
    options = { audio_codec: "pcm_s16le", custom: %w(-f s16le -ac 1 -ar 16000)}
    another = audio.transcode("tmp/ad.pcm", options)
    file =  URI.open(another.path)
    @sp.attachment.attach(io: file, filename: 'ad.pcm')

here is the error


I, [2020-03-22T05:36:34.730904 #83869]  INFO -- : Running transcoding...
["/usr/local/bin/ffmpeg", "-y", "-i", "/var/folders/fs/t7h8z7h54vl_njb3hzn9205h0000gn/T/RackMultipart20200322-83869-u38jfx.wav", "-acodec", "pcm_s16le", "-f", "s16le", "-ac", "1", "-ar", "16000", "tmp/ad.pcm"]

E, [2020-03-22T05:36:34.823082 #83869] ERROR -- : Failed encoding...
["/usr/local/bin/ffmpeg", "-y", "-i", "/var/folders/fs/t7h8z7h54vl_njb3hzn9205h0000gn/T/RackMultipart20200322-83869-u38jfx.wav", "-acodec", "pcm_s16le", "-f", "s16le", "-ac", "1", "-ar", "16000", "tmp/ad.pcm"]

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[caf @ 0x7fa44d00c200] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, caf, from '/var/folders/fs/t7h8z7h54vl_njb3hzn9205h0000gn/T/RackMultipart20200322-83869-u38jfx.wav':
  Duration: 00:00:03.03, start: 0.000000, bitrate: 716 kb/s
    Stream #0:0: Audio: pcm_s16le (lpcm / 0x6D63706C), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'tmp/ad.pcm':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
    Metadata:
      encoder         : Lavc58.54.100 pcm_s16le
size=      95kB time=00:00:03.02 bitrate= 256.0kbits/s speed= 993x    
video:0kB audio:95kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

Errors: encoded file is invalid. 

Completed 500 Internal Server Error in 199ms (ActiveRecord: 5.4ms)


  
FFMPEG::Error (Failed encoding.Errors: encoded file is invalid. Full output: ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[caf @ 0x7fa44d00c200] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, caf, from '/var/folders/fs/t7h8z7h54vl_njb3hzn9205h0000gn/T/RackMultipart20200322-83869-u38jfx.wav':
  Duration: 00:00:03.03, start: 0.000000, bitrate: 716 kb/s
    Stream #0:0: Audio: pcm_s16le (lpcm / 0x6D63706C), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'tmp/ad.pcm':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
    Metadata:
      encoder         : Lavc58.54.100 pcm_s16le
size=      95kB time=00:00:03.02 bitrate= 256.0kbits/s speed= 993x    
video:0kB audio:95kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
):
  


@Davidzhu001
Copy link
Author

here is my ffmpeg command

ffmpeg -y -i test.mp3 -acodec pcm_s16le -f s16le -ac 1 -ar 16000 test.pcm

@klausbadelt
Copy link

Maybe b/c there's no *.pcm muxer - I don't know that audio file format, and it seems ffmpeg neither. Try ffmpeg -muxers | grep pcm, mine shows no result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants