Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

dart - Flutter FFmpeg moov atom not found whilst running ffmpeg command during recording

Hi am currently trying to retrieve 3 second clips of an audio file whilst it is recording in flutter. I am using the recording module flutter sound and flutter ffmpeg.

I record the audio file with default codec (.aac). The file is saved to the cache getTemporaryDirectory()

I then copy the file using this flutter ffmpeg code

List<String> arguments = ["-ss", start.toString(), "-i", inPath, "-to", end.toString(), "-c", "copy", outPath];

await flutterFFmpeg.executeWithArguments(arguments);

Start: start time (e.g. 0) and End: end time (e.g. 3)

It then returns this error

FFmpeg exited with rc: 1 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x748964ea00] moov atom not found

Helpful information:

  1. A moov atom is data about the file (e.g timescale,duration)
  2. I know the inPath exists because I check that before executing ffmpeg command
  3. The outPath is also format .aac
  4. This ffmpeg function is being ran whilst the recording is still occurring
  5. Example inPath uri looks like this /data/user/0/com.my.app/cache/output.aac
  6. I have no problems when running on iOS, only on android

I would be grateful for help, I have spent many days trying to fix this problem. If you need anymore info please leave a comment. Thanks

question from:https://stackoverflow.com/questions/65927131/flutter-ffmpeg-moov-atom-not-found-whilst-running-ffmpeg-command-during-recordin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Default Codec is not guaranteed to be AAC/ADTS. It will depend of the Android version of your device.

You can do several things to understand better :

  • ffprobe on your file to see what has been recorded by Flutter Sound.

  • Use a specific Codec instead of default : aac/adts is a good choice because it can be streamed (you want to process the audio data during the recording and not after closing the file)

  • Verify that your file contains something and that the data are not still in internal buffers

  • Record to a dart PCM stream instead of a file. Working with a file and use FFmpeg to seek into it is complicated and perhaps does not fill your needs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...