Hi all,
I am trying to encode a video using ffmpeg.
It fails to encode. However, if I remove the '-acodec copy' option, it successfully encodes the video but the audio bitrate of the output file is not consistent with the '-ab 112000' option. I get the audio bitrate of 82k.ffmpeg -i inpput.mov -vb 512000 -ab 112000 -acodec copy out.mp4
Can you please tell me whats the reason for that. Any help is welcome.
+ Reply to Thread
Results 1 to 9 of 9
-
-
The input file is given by:
abc@test24:~/Documents/videos$ ffmpeg -i paris.mov
ffmpeg version git-2012-05-10-eee89f6 Copyright (c) 2000-2012 the FFmpeg developers
built on May 10 2012 16:42:00 with gcc 4.4.3
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
libavutil 51. 50.100 / 51. 50.100
libavcodec 54. 21.101 / 54. 21.101
libavformat 54. 4.100 / 54. 4.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 72.105 / 2. 72.105
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'paris.mov':
Metadata:
creation_time : 2003-02-12 17:49:41
Duration: 00:35:37.05, start: 0.000000, bitrate: 15947 kb/s
Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 720x486 [SAR 72:72 DAR 40:27], 14410 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
timecode : 01:00:00:00
At least one output file must be specified
abc@test24:~/Documents/videos$ ffmpeg -i paris.mov -vb 512000 -ab 112000 -g 12 -acodec copy paris/test_paris512.mp4
ffmpeg version git-2012-05-10-eee89f6 Copyright (c) 2000-2012 the FFmpeg developers
built on May 10 2012 16:42:00 with gcc 4.4.3
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
libavutil 51. 50.100 / 51. 50.100
libavcodec 54. 21.101 / 54. 21.101
libavformat 54. 4.100 / 54. 4.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 72.105 / 2. 72.105
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'paris.mov':
Metadata:
creation_time : 2003-02-12 17:49:41
Duration: 00:35:37.05, start: 0.000000, bitrate: 15947 kb/s
Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 720x486 [SAR 72:72 DAR 40:27], 14410 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
timecode : 01:00:00:00
File 'paris/test_paris512.mp4' already exists. Overwrite ? [y/N] y
w:720 h:486 pixfmt:yuvj422p tb:1/1000000 sar:72/72 sws_param:flags=2
[buffersink @ 0x9a21640] No opaque field provided
[format @ 0x9a21c80] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'format'
[scale @ 0x9a21920] w:720 h:486 fmt:yuvj422p sar:72/72 -> w:720 h:486 fmt:yuvj420p sar:1/1 flags:0x4
[libx264 @ 0x9a1ff80] using SAR=1/1
[libx264 @ 0x9a1ff80] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x9a1ff80] profile High, level 3.0
[libx264 @ 0x9a1ff80] 264 - core 124 r2197 69a0443 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=12 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x9a1faa0] track 1: could not find tag, codec not currently supported in container
Output #0, mp4, to 'paris/test_paris512.mp4':
Metadata:
creation_time : 2003-02-12 17:49:41
encoder : Lavf54.4.100
Stream #0:0(eng): Video: h264 (![0][0][0] / 0x0021), yuvj420p, 720x486 [SAR 1:1 DAR 40:27], q=-1--1, 512 kb/s, 2997 tbn, 23.98 tbc
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, 1536 kb/s
Metadata:
creation_time : 2003-02-12 17:49:41
handler_name : Apple Alias Data Handler
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg -> libx264)
Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ? -
Hi
Your input mov is:-
Video: mjpeg (jpeg / 0x6765706A), yuvj422p, 720x486 [SAR 72:72 DAR 40:27], 14410 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbcAudio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s -
I am trying to convert it into a mp4 file with audio codec aac and audio bitrate 112kbps. Just want to mention that if I replace the '-acodec copy' with '-acodec aac', it gives the same error.
-
The bitrate will always be the same as the source using '-acodec copy'. You can only change it if you re-encode the stream.
Although you're re-encoding the video, the '-g 12' option will be ignored as MJPEG only uses intraframe compression - no GOP structure exists.
You can only set the bitrate for codecs that use compression. On top of that, some compressed formats like DV don't allow you to change the bitrate. Setting the bitrate for uncompressed audio/video streams (pcm_s16be in your case) doesn't make sense.
You've chosen a very low bitrate for 720x486 MJPEG video - around 30x lower than the source. If you want to reduce the video bitrate, use a different codec (like x264) and think about reducing the frame size (*be careful if the source is interlaced*). -
Hi
The audio parameters are:-
-c:a libfaac -b:a 112k -ar 44100 -ac 2
Code:ffmpeg -i paris.mov -c:v libx264 -b:v 512k -c:a libfaac -b:a 112k -ar 44100 -ac 2 test_paris.mp4
Code:ffmpeg -i paris.mov -c:v libx264 -preset medium -crf 23 -c:a libfaac -b:a 112k -ar 44100 -ac 2 test_paris.mp4
-
@intracube: Thanks a lot, you answered a lot of questions in my mind. I was really a fool trying to use '-acodec copy' and also setting the audio bitrate. But why doesn't it work when I use '-acodec aac' option? and as I am encoding it to mp4, don't you think it will automatically set the video codec to h264?
@bat999: Thanks a lot you madeit quite simple for me. One question. What is the difference in using '-acodec aac' and '-c:a libfaac' options? Apparently they both encode the audio to aac format. -
Hi
aac is FFmpeg's own internal aac encoder.
libfaac is a (probably better) external aac encoder.
Your FFmpeg has been built with .... --enable-libfaac in the configuration.
So it's OK for you to use libfaac.Last edited by bat999; 30th May 2012 at 09:16.
Similar Threads
-
FFmpeg's Bitrate Tolerance Option...
By raymng in forum Video ConversionReplies: 1Last Post: 13th Mar 2012, 09:08 -
-acodec copy to 6 channel audio results in 2 channel?
By ninethirty in forum Video ConversionReplies: 1Last Post: 11th Feb 2011, 11:54 -
FFmpeg ignores -aspect option when converting from .ts to .dv
By intracube in forum Video ConversionReplies: 1Last Post: 12th Jan 2011, 17:53 -
FFmpeg -acodec copy
By sldvd in forum AudioReplies: 2Last Post: 8th Sep 2010, 13:25 -
ffmpeg faststart option? for progressive dl viewing
By kosso in forum ffmpegX general discussionReplies: 0Last Post: 22nd Aug 2007, 06:21