mp4 + aac => mp4 vagy flv [MEGOLDVA]

Fórumok

Ugatom az alapokat is, nem tudom, milyen videót milyen hanggal lehet/nem lehet összefűzni.
A neten talált avconv meg mencoder command line példákat próbálom értelemszerűen alaklmazni az esetemre nulla sikerrel.
Mencoder-rel kreált mp4 alá szeretnék aac hangot tenni, kimenet ismét mp4 vagy flv. (Úgy olvastam, hogy az input hang mp3 nem lehet, bár olyan formában is megvan.)
Ubuntu Salamander az opsys.
Segítene valaki egy command line mintával? Előre is köszönöm.

Hozzászólások

Nem tudom eldönteni, túl nehéz vagy túl triviális a kérdés...

Hát igen, ezért kértem egy mintát :(((

A számtalan forma közül egy, ahogy próbálom:
avconv -i hang.aac -i video.mp4 -c:a aac -strict -2 -c:v output.mp4

Hibaüzenet:
At least one output file must be specified.

Azért kértem egy mintát, ami működik, mert a man szerint az általános formának megfelelek... :((
avconv [global options] [[infile options][-i infile]]... {[outfile options] outfile}

Én ilyen formában szoktam videót szenvedni.

ffmpeg -i in.mp4 -i im.mp3 -vcodec copy out.mp4

--
openSUSE 12.2 x86_64

steve@desktop:~/Asztal$ ffmpeg -i video.mp4 -i audio.mp3 -vcodec copy out.mp4
ffmpeg version 0.8.7-6:0.8.7-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
built on Oct 11 2013 08:46:16 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, avi, from 'video.mp4':
Metadata:
encoder : MEncoder svn r34540 (Ubuntu), built with gcc-4.7
Duration: 00:04:24.66, start: 0.000000, bitrate: 1166 kb/s
Stream #0.0: Video: mpeg4 (Simple Profile), yuv420p, 1024x768 [PAR 1:1 DAR 4:3], 24 tbr, 24 tbn, 24 tbc
[mp3 @ 0x9852f00] max_analyze_duration reached
[mp3 @ 0x9852f00] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio.mp3':
Duration: 00:14:48.48, start: 0.000000, bitrate: 128 kb/s
Stream #1.0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it.
steve@desktop:~/Asztal$

A hang nem is aac...
steve@desktop:~/Asztal$ file audio.mp3
audio.mp3: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
steve@desktop:~/Asztal$

Óhh, igen. Ezt elsőre mindig beszopom...


ffmpeg -i video.mp4 -i audio.mp3 -strict experimental -vcodec copy out.mp4

Az nem baj, hogy most nem aac, majd az lesz. Ilyet csinál: "Videó: Kodek H.264, Hang: Kodek MPEG-4 AAC"

Ha a -vcodec copy-t cseréled -c copy-ra, akkor a mind2 kodekket az eredeti forrásból veszi. pl. "MPEG-1 Layer 3 (MP3)"

--
openSUSE 12.2 x86_64

Hadd idézzem innen
http://askubuntu.com/questions/369947/merge-mp4-aac
a választ, ami segített.
Az alapvető baj az volt, hogy a hang lényegesen rövidebb volt, ettől volt lejátszó, ami semmi hangot nem adott(Totem), más meg igen(VLC).

It depends a bit how your streams are mapped within the mp4 file. Something like this should work:

ffmpeg -i video.mp4 -i audio.aac -map 0:0 -map 1:0 -vcodec copy -acodec copy newvideo.mp4

Usually the videostream is mapped as first stream in the container.
If it isn't mapped as first stream, change the mapping:

ffmpeg -i video.mp4 -i audio.aac -map 0:1 -map 1:0 -vcodec copy -acodec copy newvideo.mp4

To find out how the streams in your video file actually were mapped in the first place you can use mediainfo which is in the standard Ubuntu repositories nowadays.

If we break down the commandline here it works like this:

-i video.mp4 -> first media file
-i audio.aac -> second media file
-map 0:1 -> use the second stream from the first mediafile
-map 1:0 -> use the first stream from the second mediafile
-vcodec copy -> leave the video as is
-acodec copy -> leave the audio as is
newvideo -> resulting videofile

Make sure that the audiofile and the videofile have the same duration. Not every player is accepting tracks with huge duration differences