This sounds like you configured ffmpeg incorrectly.
post #121 of 176
12/6/08 at 4:40pm

|
It looks as if mencoder was assuming an input rate of 25fps, adding -fps 29.97 as well as -ofps 29.97 in the mencoder command pretty much clears it up. I'm not sure that it's perfect yet but it's certainly much better.
|
m2tstoavi.fifo.txt 1.90234375k . file
rm -f $videofifo rm -f $audiofile
set sourcedir=/media/CANON/AVCHD/BDMV/STREAM
#!/bin/csh -f
#The scripts and instructions in this package are free to use and
#redistribute AT YOUR OWN RISK!! Standard disclaimers apply.
#NO WARRANTY!
if ( $#argv == "0" ) then
echo usage: $0 filename.m2ts ...
exit
else
if ("$1" == '-h') then
set xsz = 1920
set aspect = "16:9"
shift
else if ("$1" == '-l') then
set xsz = 1440
set aspect = "4:3"
shift
else
set xsz = 1440
set aspect = "4:3"
endif
#set files=`find $* -name "*.m2ts"`
endif
set path = ( . $path )
set camerasourcedir=/media/CANON/AVCHD/BDMV/STREAM
echo using:
which xporthdmv || exit
which ldecod || exit
which ffmpeg || exit
which hdrsr1cp || exit
echo $0 Starting.
echo " "
# if camera is found, ask for importing
if (-d $camerasourcedir) then
echo "Your camera connection has been detected. Import Videos? [y/n]:"
set doimport = $<
switch ($doimport)
case [yY]:
echo Starting import from camera...
./hdrsr1cp
echo Import complete.
breaksw
default:
breaksw
endsw
endif
echo Starting video conversion...
set files=`find $* -name "*.m2ts"`
foreach file ($files)
if ( ! -f $file ) then
echo file $file not found
exit
endif
set filebase=`basename $file | sed s/\\.m2ts// | sed s/\\.MTS//`
set outdir=`dirname $file`;
set audiofile=/tmp/$filebase".ac3"
set videofifo=/tmp/$filebase".yuv"
set outputfile=$outdir/$filebase".avi"
if ( ! -f $outputfile ) then
if ( ! -f $audiofile ) then
echo xporthdmv -hn $file 1 1 1
xporthdmv -hn $file 1 1 1 && mv bits0001.mpa $audiofile
else
echo $audiofile already exists, not creating it.
endif
mkfifo $videofifo
echo ldecod -i bits0001.mpv -o $videofifo
ldecod -i bits0001.mpv -o $videofifo &
echo ffmpeg -r 29.97 -s ${xsz}x1080 -vcodec mpeg4 \\
-sameq -i $videofifo -aspect ${aspect} \\
-acodec mp3 -i $audiofile -b 15000k \\
$outputfile || exit 1
ffmpeg -r 29.97 -s ${xsz}x1080 -vcodec mpeg4 \\
-sameq -i $videofifo -aspect ${aspect} \\
-acodec mp3 -i $audiofile -b 15000k \\
$outputfile || exit 1
else
echo $outputfile:t exists, not creating it.
endif
# remove intermediate files
rm -f $videofifo
rm -f $audiofile
end
#echo To remove temporary files: rm -f /tmp/*.ac3 /tmp/*.yuv
#rm -f ./dataDec.txt ./log.dec bits0001.mpv $videofifo $audiofile
rm -f ./dataDec.txt
rm -f ./log.dec
rm -f bits0001.mpv
echo $0 complete.
/usr/bin/mencoder $1 -o $1-DVD.avi -fps 60 -ofps 60 -oac mp3lame -lameopts br=256 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:v4mv:cbp:vbitrate=4000 -vf yadif=1,scale=854:480

/usr/bin/mencoder $1 -o $1-DVD.avi -fps 60 -ofps 60 -oac mp3lame -lameopts br=256 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:v4mv:cbp:vbitrate=4000 -vf yadif=1,scale=854:480





ffmpeg -y -i input_file.mts -an -pix_fmt yuv420p -f rawvideo - | ffmpeg -y -i /var/tmp/temp_audio_file.wav -r 60000/1001 -deinterlace -s 1920x1080 -pix_fmt yuv420p -f rawvideo -i - -r 60000/1001 -s 1280x720 -vcodec mpeg4 -sameq -shortest -f mov -acodec libfaac -ac 2 -ab 128k -ar 44100 output_file.mov
xporthdmv -h 2009-01-05-21-13-32.m2ts 1 1 1 mv bits0001.mpa /tmp/2009-01-05-21-13-32.ac3 ldecod -i bits0001.mpv -o /tmp/2009-01-05-21-13-32.yuv
ffmpeg -r 29.97002997 -s 1440x1080 -i /tmp/2009-01-05-21-13-32.yuv -i /tmp/2009-01-05-21-13-32.ac3 -vcodec mpeg4 -sameq -acodec copy -aspect 4:3 -b 15000k 2009-01-05-21-13-32.avi
FFmpeg version SVN-r16240, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --shlibdir=/usr/lib --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib --enable-shared --enabl
e-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaad --enable-libfaac --enable-libxvid --enable-swsca
le --enable-postproc --enable-gpl --enable-vhook --enable-x11grab --enable-libschroedinger --enable-libdirac --enabl
e-libgsm --enable-libx264 --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-nonfree --enable-pthread
s
libavutil 49.12. 0 / 49.12. 0
libavcodec 52. 7. 0 / 52. 7. 0
libavformat 52.23. 1 / 52.23. 1
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Dec 19 2008 20:23:44, gcc: 4.3.2 [gcc-4_3-branch revision 141291]
Input #0, rawvideo, from '/tmp/2009-01-05-21-13-32.yuv':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 1440x1080, 29.97 tb(r)
Input #1, ac3, from '/tmp/2009-01-05-21-13-32.ac3':
Duration: 00:00:48.00, bitrate: 256 kb/s
Stream #1.0: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Output #0, avi, to '2009-01-05-21-13-32.avi':
Stream #0.0: Video: mpeg4, yuv420p, 1440x1080 [PAR 1:1 DAR 4:3], q=2-31, 15000 kb/s, 29.97 tb(c)
Stream #0.1: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
Press [q] to stop encoding
frame= 1440 fps= 28 q=0.0 Lsize= 149167kB time=48.00 bitrate=25457.8kbits/s
video:147587kB audio:1500kB global headers:0kB muxing overhead 0.053214%
ffmpeg -v 5 -i 2009-01-05-21-13-32.avi -f null -
(... redundant output omitted...)
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from '2009-01-05-21-13-32.avi':
Duration: 00:00:48.04, start: 0.000000, bitrate: 25432 kb/s
Stream #0.0, 1001/30000: Video: mpeg4, yuv420p, 1440x1080 [PAR 1:1 DAR 4:3], 1/30000, 29.97 tb(r)
Stream #0.1, 4/125: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
Output #0, null, to 'pipe:':
Stream #0.0, 1/90000: Video: rawvideo, yuv420p, 1440x1080 [PAR 1:1 DAR 4:3], 1001/30000, q=2-31, 200 kb/s, 29.97
tb(c)
Stream #0.1, 1/90000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1440 fps= 99 q=0.0 Lsize= -0kB time=48.00 bitrate= -0.0kbits/s dup=0 drop=0
video:0kB audio:9000kB global headers:0kB muxing overhead -100.000239%

|
Okay, this is getting a bit off topic, but I would like to see your source that says those values are stored in the AVC stream. Framerate and aspect ratio are stored, of course. Have you spent any time looking at the transport stream? Can you find a date and time? Can you find any of those other values?
|
canon_analyze_mts.pl.zip 2.1318359375k . file



