[FFmpeg-user] adding -ss and -t loses the audio stream on the output

Tim Nicholson tim.nicholson at bbc.co.uk
Tue Jan 24 17:47:48 CET 2012


So I have a command line to make two versions of a file that works 
perfectly until I add in "-ss time -t duration". Then although 
everything seems to work as normal, and the created files are the right 
duration they lack the audio stream

ffmpeg -i BRD38962303.mxf \
-f lavfi -i "amovie=BRD38962303.mxf:si=1 [a1]; 
amovie=BRD38962303.mxf:si=2 [a2]; [a1][a2] amerge, 
aformat=s16:stereo:all " \
-map 0:0 -map 1:0 \
-vf "yadif=0:-1:0, scale=480:360 [scaled];
movie=/home/tim/bin/KLARC_logo.png [logo];
[scaled][logo] overlay=6:4" \
-c:v libx264 -pix_fmt yuv420p \
-b:v 704k -r 25 -maxrate 704k -bufsize 5097k \
-c:a libfaac -b:a 96k -ar 48000 -ac 2 \
-ss 11.6 -t 19.4 \
-y ./BRD38962303-dog.mp4 \
-map 0:0 -map 1:0 \
-vf "yadif=0:-1:0, scale=480:360, 
drawtext=fontfile=/usr/share/fonts/truetype/DroidSans.ttf: 
timecode='00\:00\:00\:00': r=25: x=(w-tw)/2: y=(1*lh): fontcolor=white: 
fontsize=30: box=1: boxcolor=0x00000000 at 1" \
-c:v libx264 -pix_fmt yuv420p \
-b:v 704k -r 25 -maxrate 704k -bufsize 5097k -g 30 \
-c:a libfaac -b:a 96k -ar 48000 -ac 2 \
-ss 11.6 -t 19.4 \
-y ./BRD38962303-btc.mp4
ffmpeg version N-36728-g794006f-by_Tim Copyright (c) 2000-2012 the 
FFmpeg developers
   built on Jan 12 2012 11:45:18 with gcc 4.6.2
   configuration: --extra-version=by_Tim --enable-static 
--disable-shared --enable-gpl --enable-nonfree --enable-version3 
--prefix=/mnt/msds-store-0/tim/ffmpeg-tux/usr/local 
--libdir=/mnt/msds-store-0/tim/ffmpeg-tux/usr/local/lib64 
--enable-runtime-cpudetect --extra-cflags='-static 
-I/mnt/msds-store-0/tim/ffmpeg-tux/usr/local/include' 
--extra-ldflags='-static 
-L/mnt/msds-store-0/tim/ffmpeg-tux/usr/local/lib64' 
--progs-suffix=static --enable-libfaac --enable-libx264 --enable-libfreetype
   libavutil      51. 34.100 / 51. 34.100
   libavcodec     53. 55.100 / 53. 55.100
   libavformat    53. 29.100 / 53. 29.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 58.100 /  2. 58.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  6.100 /  0.  6.100
   libpostproc    51.  2.100 / 51.  2.100
[mxf @ 0x176fbc0] could not resolve material track sequence strong ref
Input #0, mxf, from 'BRD38962303-4x3.mxf':
   Duration: 00:01:01.92, start: 0.000000, bitrate: 225833 kb/s
     Stream #0:0: Video: v210, yuv422p10le, 720x576, 25 fps, 25 tbr, 25 
tbn, 25 tbc
     Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
     Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
     Stream #0:3: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
     Stream #0:4: Audio: pcm_s24le, 48000 Hz, 1 channels, s32, 1152 kb/s
[mxf @ 0x178ca60] could not resolve material track sequence strong ref
[amovie @ 0x17a01e0] seek_point:0 format_name:(null) 
file_name:BRD38962303-4x3.mxf stream_index:1
[mxf @ 0x1797260] could not resolve material track sequence strong ref
[amovie @ 0x17c5180] seek_point:0 format_name:(null) 
file_name:BRD38962303-4x3.mxf stream_index:2
[amerge @ 0x17c1be0] Inputs overlap: output layout will be meaningless
[aformat @ 0x17c1740] auto-inserting filter 'auto-inserted aconvert 0' 
between the filter 'Parsed_amerge_2' and the filter 'Parsed_aformat_3'
[amerge @ 0x17c1be0] in1:mono + in2:mono -> out:stereo
[aconvert @ 0x1781f80] fmt:s32 cl:stereo planar:0 -> fmt:s16 cl:stereo 
planar:0
[lavfi @ 0x179ed60] Estimating duration from bitrate, this may be inaccurate
Input #1, lavfi, from 'amovie=BRD38962303-4x3.mxf:si=1 [a1]; 
amovie=BRD38962303-4x3.mxf:si=2 [a2]; [a1][a2] amerge, 
aformat=s16:stereo:all ':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[buffer @ 0x17c1f60] w:720 h:576 pixfmt:yuv422p10le tb:1/1000000 sar:0/1 
sws_param:
[yadif @ 0x17c2820] mode:0 parity:-1 auto_enable:0
[movie @ 0x1784cc0] seek_point:0 format_name:(null) 
file_name:/home/tim/bin/KLARC_logo.png stream_index:0
[overlay @ 0x1785fa0] auto-inserting filter 'auto-inserted scale 1' 
between the filter 'Parsed_movie_2' and the filter 'Parsed_overlay_3'
[scale @ 0x17860e0] w:720 h:576 fmt:yuv422p10le -> w:480 h:360 
fmt:yuv420p flags:0x4
[scale @ 0x17d0320] w:53 h:15 fmt:bgra -> w:53 h:15 fmt:yuva420p flags:0x4
[overlay @ 0x1785fa0] main w:480 h:360 fmt:yuv420p overlay x:6 y:4 w:53 
h:15 fmt:yuva420p
[overlay @ 0x1785fa0] main_tb:1/1000000 overlay_tb:1/25 -> tb:1/1000000 
exact:1
[buffer @ 0x18891a0] w:720 h:576 pixfmt:yuv422p10le tb:1/1000000 sar:0/1 
sws_param:
[yadif @ 0x188b440] mode:0 parity:-1 auto_enable:0
[scale @ 0x188b320] w:720 h:576 fmt:yuv422p10le -> w:480 h:360 
fmt:yuv420p flags:0x4
[libx264 @ 0x1795bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 
FastShuffle Cache64
[libx264 @ 0x1795bc0] profile High, level 3.0
[libx264 @ 0x1795bc0] 264 - core 118 r2092 6eac7c3 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2011 - 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=12 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=250 keyint_min=25 scenecut=40 
intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=704 ratetol=1.0 
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=704 vbv_bufsize=5097 
nal_hrd=none ip_ratio=1.40 aq=1:1.00
[libx264 @ 0x17c2ec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 
FastShuffle Cache64
[libx264 @ 0x17c2ec0] profile High, level 3.0
[libx264 @ 0x17c2ec0] 264 - core 118 r2092 6eac7c3 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2011 - 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=12 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=30 keyint_min=3 scenecut=40 
intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=704 ratetol=1.0 
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=704 vbv_bufsize=5097 
nal_hrd=none ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to './BRD38962303-dog.mp4':
   Metadata:
     encoder         : Lavf53.29.100
     Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 480x360, 
q=-1--1, 704 kb/s, 25 tbn, 25 tbc
     Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, 2 
channels, s16, 96 kb/s
Output #1, mp4, to './BRD38962303-btc.mp4':
   Metadata:
     encoder         : Lavf53.29.100
     Stream #1:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 480x360, 
q=-1--1, 704 kb/s, 25 tbn, 25 tbc
     Stream #1:1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, 2 
channels, s16, 96 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (v210 -> libx264)
   Stream #1:0 -> #0:1 (pcm_s16le -> libfaac)
   Stream #0:0 -> #1:0 (v210 -> libx264)
   Stream #1:0 -> #1:1 (pcm_s16le -> libfaac)

So the stream mappings look correct but then:-

ffprobe BRD38962303-dog.mp4
ffprobe version N-36728-g794006f-by_Tim Copyright (c) 2007-2012 the 
FFmpeg developers
   built on Jan 12 2012 11:45:18 with gcc 4.6.2
   [...]
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BRD38962303-dog.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf53.29.100
   Duration: 00:00:19.36, start: 0.000000, bitrate: 725 kb/s
     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
480x360, 722 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
     Metadata:
       handler_name    :

Look no audio.......
-- 
Tim

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					


More information about the ffmpeg-user mailing list