Have a aaa.mkv video file which should be converted to a bbb.avi video.
The video part should just be copied while the audio track be converted to LameMP3 with a bitrate of 160kbps
How can I achive this with ffmpeg?
I have always difficulties to get a working video.
If ffmpeg does not offer such a conversion then maybe there is another tool.....
Peter
+ Reply to Thread
Results 1 to 14 of 14
-
-
Code:
ffmpeg -i video.mkv -c:v copy -c:a libmp3lame -b:a 128k video.avi
Code:ffmpeg -i video.mkv -vcodec copy -acodec libmp3lame -ab 128k video.avi
But avi does not support all kinds of video codecs. If so then just reconvert to xvid. -
Ok when I start this run then ffmpeg tells me:
[avi @ 0000000002b70680] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)
av_interleaved_write_frame(): Invalid argument
[avi @ 0000000002b70680] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)
frame= 6 fps=0.0 q=-1.0 Lsize= 10kB time=00:00:00.14 bitrate= 549.6kbits/s
video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 91.301033%
Conversion failed!
So I added as suggested "-bsf h264_mp4toannexb" as parameter. This helps partially. Now I got:
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missing
Last message repeated 276 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte= 138.3kbits/s
Last message repeated 259 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte= 147.6kbits/s
Last message repeated 248 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte= 548.2kbits/s
Last message repeated 240 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte= 787.5kbits/s
Last message repeated 243 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte= 918.7kbits/s
Last message repeated 243 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte=1074.8kbits/s
Last message repeated 236 times
[avi @ 0000000005617cc0] H.264 bitstream error, startcode missingte=1132.0kbits/s
Last message repeated 243 times
...
The result *.avi seems to be ok now.
However: Whats wrong?
Is it a mistake by the outer *.mkv container or the inner video part encoding?
How can I repair the original *.mkv BEFORE running the actual conversion?
Can I add ALWAYS as default the parameter "-bsf h264_mp4toannexb" or could it damage something in other *.mkv files? -
I presume you have downloaded ver 4.2.0.xxx. Bottom left side there are options to select video and audio codecs. Since to want the video maintained as such, select the codec option as 'direct copy' and for the audio, select the appropriate audio needed.
-
Ok, but when I select this (and specify audio only re-encoding) then start "Encode" no output file is created.
Logfile shows:
"Missing output file D:\movies\testTEnc.avi"
Yes, output file is missing! Obviously it should be created.
Or does Tencoder require an existing *.avi when audio-only should be encoded? -
Hmmm...strange!
I suspect then that your original file could be damaged or corrupted.
I'm no expert but I extensively use this software for my conversions. I suggest you to contact 'ozok' directly. He is very responsive and helpful. His email is in the help>about section. Or he has threads running at this website...
Another suggestion is to try your encoding both encoders- Mencoder or FFMpeg. You can change that at the bottom right side of the software. -
Have U tried to remux the mkv? Try "ffmpeg -i old.mkv -vcodec copy -acodec copy new.mkv" to fix time-issues, and then reencode with "ffmpeg -i new.mkv -vcodec copy -acodec libmp3lame -b:a 160k reencoded.avi"
P.S: AVI and H.264 are no good friends only mpeg4 pt 2 should meet the standard and even then u might wanna change the fourcc with "-vtag xvid"..Last edited by TorBru; 31st Jul 2014 at 13:55.
-
Encoder Log 1
-mc 0 -priority idle -ovc copy :vpass=1:turbo -of avi -passlogfile "D:\av\TEncoder [sf]\testTEnc.log" -nosound -o NUL "D:\tmp\testTEnc.mkv"
-mc 0 -priority idle -aid 1 -ovc copy :vpass=2 -of avi -srate 48000 -oac mp3lame -lameopts cbr:br=160: -channels 2 -delay 0 -nosub -passlogfile "D:\av\TEncoder [sf]\testTEnc.log" -o "D:\tmp\testTEnc.avi" "D:\tmp\testTEnc.mkv"
MEncoder UNKNOWN-4.6.2 (C) 2000-2012 MPlayer Team
Setting process priority: idle
201 audio & 416 video codecs
File not found: ':vpass=1:turbo'
Failed to open :vpass=1:turbo.
Cannot open file/device.
Exiting...
MEncoder UNKNOWN-4.6.2 (C) 2000-2012 MPlayer Team
Setting process priority: idle
201 audio & 416 video codecs
File not found: ':vpass=2'
Failed to open :vpass=2.
Cannot open file/device.
Exiting...
...seems to me a cmdline parameter passing error of TEncoder -
crashing too:
Encoder Log 1
-y -threads 8 -i "D:\tmp\testTEnc.mkv" -pass 1 -passlogfile "D:\av\TEncoder [sf]\testTEnc.log" -vcodec copy -f avi -an "D:\tmp\testTEnc.avi"
-y -itsoffset 0 -threads 8 -i "D:\tmp\testTEnc.mkv" -pass 2 -passlogfile "D:\av\TEncoder [sf]\testTEnc.log" -vcodec copy -f avi -map 0:0 -map 0:1 -acodec libmp3lame -ab 160k -af aresample=resampler=soxr -ar 48000 -ac 2 "D:\tmp\testTEnc.avi"
ffmpeg version N-64796-gd5ee358 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 19 2014 03:32:29 with gcc 4.8.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 52. 92.101 / 52. 92.101
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.101 / 55. 48.101
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.102 / 4. 11.102
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, matroska,webm, from 'D:\tmp\testTEnc.mkv':
Metadata:
encoder : libebml v0.7.9 + libmatroska v0.8.1
creation_time : 2014-04-20 18:58:07
Duration: 01:02:14.46, start: 0.000000, bitrate: 1240 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 720x404, SAR 1:1 DAR 180:101, 25 fps, 25 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
Output #0, avi, to 'D:\tmp\testTEnc.avi':
Metadata:
ISFT : Lavf55.48.101
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 720x404 [SAR 1:1 DAR 180:101], q=2-31, 25 fps, 47.95 tbn, 47.95 tbc (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[avi @ 00000000055f7120] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)
av_interleaved_write_frame(): Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 6kB time=00:00:00.-6 bitrate=N/A
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 395.979462%
Conversion failed!
ffmpeg version N-64796-gd5ee358 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 19 2014 03:32:29 with gcc 4.8.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
libavutil 52. 92.101 / 52. 92.101
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.101 / 55. 48.101
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.102 / 4. 11.102
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, matroska,webm, from 'D:\tmp\testTEnc.mkv':
Metadata:
encoder : libebml v0.7.9 + libmatroska v0.8.1
creation_time : 2014-04-20 18:58:07
Duration: 01:02:14.46, start: 0.000000, bitrate: 1240 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 720x404, SAR 1:1 DAR 180:101, 25 fps, 25 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
Output #0, avi, to 'D:\tmp\testTEnc.avi':
Metadata:
ISFT : Lavf55.48.101
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 720x404 [SAR 1:1 DAR 180:101], q=2-31, 25 fps, 47.95 tbn, 47.95 tbc (default)
Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 160 kb/s (default)
Metadata:
encoder : Lavc55.69.100 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[avi @ 00000000057ef060] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)
av_interleaved_write_frame(): Invalid argument
frame= 1 fps=0.0 q=-1.0 Lsize= 10kB time=00:00:00.00 bitrate=N/A
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 539.175232%
Conversion failed! -
H.264 in AVI breaks the standards - you must transcode to MPEG4 pt. 2. I'm pretty shure thats the problem.