Command of FFMPEG to make a video from Image(JPEG) + Audio(.mp3) & Share video in Whatsapp
I am trying to create a video .mp4 file from .mp3 audio & .jpeg image.
I am able to create a video and able to play it in video players on Android devices.
But after creation of file when I tried to share that video in WhatsApp, at that time it shows a message "The file format not supported".
I am using below FFMPEG command:
"-loop 1 -r 1 -i " + imageFilePath + " -i " + audioFilePath + " -c:v libx264 -crf 27 -tune stillimage -c:a copy -pix_fmt yuv420p -preset ultrafast -shortest " + pathOutputVideo(sectionName);
And for sharing video, I am using code listed below:
MediaScannerConnection.scanFile(ShareQuestionAudioActivity.this, new String{FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))},
null, new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))));
startActivity(Intent.createChooser(shareIntent, "Share Question"));
}
});
I found here that I need to use H.264 + AAC. But I'm still not able to share video with supported file format.

|
show 3 more comments
I am trying to create a video .mp4 file from .mp3 audio & .jpeg image.
I am able to create a video and able to play it in video players on Android devices.
But after creation of file when I tried to share that video in WhatsApp, at that time it shows a message "The file format not supported".
I am using below FFMPEG command:
"-loop 1 -r 1 -i " + imageFilePath + " -i " + audioFilePath + " -c:v libx264 -crf 27 -tune stillimage -c:a copy -pix_fmt yuv420p -preset ultrafast -shortest " + pathOutputVideo(sectionName);
And for sharing video, I am using code listed below:
MediaScannerConnection.scanFile(ShareQuestionAudioActivity.this, new String{FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))},
null, new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))));
startActivity(Intent.createChooser(shareIntent, "Share Question"));
}
});
I found here that I need to use H.264 + AAC. But I'm still not able to share video with supported file format.

what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
1
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44
|
show 3 more comments
I am trying to create a video .mp4 file from .mp3 audio & .jpeg image.
I am able to create a video and able to play it in video players on Android devices.
But after creation of file when I tried to share that video in WhatsApp, at that time it shows a message "The file format not supported".
I am using below FFMPEG command:
"-loop 1 -r 1 -i " + imageFilePath + " -i " + audioFilePath + " -c:v libx264 -crf 27 -tune stillimage -c:a copy -pix_fmt yuv420p -preset ultrafast -shortest " + pathOutputVideo(sectionName);
And for sharing video, I am using code listed below:
MediaScannerConnection.scanFile(ShareQuestionAudioActivity.this, new String{FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))},
null, new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))));
startActivity(Intent.createChooser(shareIntent, "Share Question"));
}
});
I found here that I need to use H.264 + AAC. But I'm still not able to share video with supported file format.

I am trying to create a video .mp4 file from .mp3 audio & .jpeg image.
I am able to create a video and able to play it in video players on Android devices.
But after creation of file when I tried to share that video in WhatsApp, at that time it shows a message "The file format not supported".
I am using below FFMPEG command:
"-loop 1 -r 1 -i " + imageFilePath + " -i " + audioFilePath + " -c:v libx264 -crf 27 -tune stillimage -c:a copy -pix_fmt yuv420p -preset ultrafast -shortest " + pathOutputVideo(sectionName);
And for sharing video, I am using code listed below:
MediaScannerConnection.scanFile(ShareQuestionAudioActivity.this, new String{FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))},
null, new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(FfmpegController.pathOutputVideo(qModel.getSectionName().toUpperCase().replaceAll(" ", "_"))));
startActivity(Intent.createChooser(shareIntent, "Share Question"));
}
});
I found here that I need to use H.264 + AAC. But I'm still not able to share video with supported file format.


edited Nov 23 '18 at 6:50


incBrain
2,25931125
2,25931125
asked Nov 22 '18 at 4:50


Neel MevadaNeel Mevada
223
223
what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
1
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44
|
show 3 more comments
what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
1
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44
what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
1
1
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44
|
show 3 more comments
1 Answer
1
active
oldest
votes
As already discussed in the comments the problem occurs due to the audio not to be encoded using AAC codec since -c:a copy
was used on mp3
audio files.
The solution to this is to tell ffmpeg
to re-encode audio stream to AAC using -c:a aac
.
More examples on how to encode AAC can also be found here.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424073%2fcommand-of-ffmpeg-to-make-a-video-from-imagejpeg-audio-mp3-share-video-i%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As already discussed in the comments the problem occurs due to the audio not to be encoded using AAC codec since -c:a copy
was used on mp3
audio files.
The solution to this is to tell ffmpeg
to re-encode audio stream to AAC using -c:a aac
.
More examples on how to encode AAC can also be found here.
add a comment |
As already discussed in the comments the problem occurs due to the audio not to be encoded using AAC codec since -c:a copy
was used on mp3
audio files.
The solution to this is to tell ffmpeg
to re-encode audio stream to AAC using -c:a aac
.
More examples on how to encode AAC can also be found here.
add a comment |
As already discussed in the comments the problem occurs due to the audio not to be encoded using AAC codec since -c:a copy
was used on mp3
audio files.
The solution to this is to tell ffmpeg
to re-encode audio stream to AAC using -c:a aac
.
More examples on how to encode AAC can also be found here.
As already discussed in the comments the problem occurs due to the audio not to be encoded using AAC codec since -c:a copy
was used on mp3
audio files.
The solution to this is to tell ffmpeg
to re-encode audio stream to AAC using -c:a aac
.
More examples on how to encode AAC can also be found here.
answered Dec 3 '18 at 11:00


incBrainincBrain
2,25931125
2,25931125
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424073%2fcommand-of-ffmpeg-to-make-a-video-from-imagejpeg-audio-mp3-share-video-i%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what you used to convert images to Video?
– Android User
Nov 22 '18 at 5:37
I am using FFMPEG only to combine Image + Audio to get Video [.mp4] output. @AndroidUser
– Neel Mevada
Nov 22 '18 at 6:20
@NeelMevada can you share the mp4 file you created?
– incBrain
Nov 23 '18 at 2:59
@NeelMevada another question, why didn't you set shareIntent.setType("video/mp4"); for mp4 file?
– incBrain
Nov 23 '18 at 3:02
1
@incBrain Thank you for your support. This is been resolved with using AAC audio codec in this command. now i am using -c:a aac and it runs well.
– Neel Mevada
Dec 3 '18 at 10:44