Sureshkumar Menon
Sureshkumar Menon

Reputation: 1165

ffmpeg avio_open() failed to open output file for writing encoded streams

i am trying to convert raw PCM into mp4 using ffmpeg ported for android.I am facing a problem in which the avio_open return negative value saying Could not open sample.mp4 which is the output file saved in sdcard.i have given filepath like /sdcard/sample.mp4 .

avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)  returns -2

/* open the output file, if needed */

 if (!(fmt->flags & AVFMT_NOFILE)) {
     if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
         fprintf(stderr, "Could not open '%s'\n", filename);
         return 1;
     }
 }

any idea?

Upvotes: 3

Views: 8362

Answers (2)

Dmytro
Dmytro

Reputation: 86

I had the same problem, but im my case I had codec and muxer enabled. Solved my problem by enabling the file protocol --enable-protocol=file.

Upvotes: 2

Raulp
Raulp

Reputation: 8206

You need to build the ffmpeg for enabling the mp4.Have you done that.For that you have to enable the muxer and codec(coder-decoder) for mp4 format in the build.sh file in the ffmpeg root directory.Codec is I think it is MPEG4.Build it and then use it for MP4 file.

Upvotes: 2

Related Questions