Sureshkumar Menon Sureshkumar Menon -4 years ago 518
Android Question

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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download