or Connect
AVS › AVS Forum › Other Areas of Interest › Camcorders › AVCHD .m2ts conversion for Linux
New Posts  All Forums:Forum Nav:

AVCHD .m2ts conversion for Linux - Page 5

post #121 of 176
This sounds like you configured ffmpeg incorrectly.
post #122 of 176
I had the same problem. When I used m2tstoavi.fifo to convert an MTS from my HF10 I got damaged header error for each frame. I previously was able to convert these MTS files in 8.04 without a problem. But this is in 8.10. m2tsoavi doesn't have this same problem.
post #123 of 176
Thanks for the advertisement. Oh, wait. It looks like 12 of your 13 posts are all advertisements for this program... that does not run on linux.
Maybe you missed the point that this is a thread for Linux and Macs.
post #124 of 176
Quote:
Originally Posted by UberBock View Post

I had the same problem. When I used m2tstoavi.fifo to convert an MTS from my HF10 I got damaged header error for each frame. I previously was able to convert these MTS files in 8.04 without a problem. But this is in 8.10. m2tsoavi doesn't have this same problem.

As set up in the standard scripts, m2tstoavi uses mencoder, but m2tstoavi.fifo uses ffmpeg.

The BIG problem I've had using mencoder is that I can't get the audio & video to sync, the video is running about 20% slow (as estimated by videoing my watch and calling out the seconds every 5 seconds). This is supported by the report at the end with gives the durations of the audio as about 30s and of the video as about 37s.

FWIW: handbrake looks to have the same problem.
post #125 of 176
Quote:
Originally Posted by jtappin View Post

The BIG problem I've had using mencoder is that I can't get the audio & video to sync, the video is running about 20% slow (as estimated by videoing my watch and calling out the seconds every 5 seconds). This is supported by the report at the end with gives the durations of the audio as about 30s and of the video as about 37s.

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.
post #126 of 176
Quote:
Originally Posted by jtappin View Post

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.

I am not too familiar with mencoder, but 29.97 is a poor approximation of the NTSC frame rate. If you have a very large movie, A/V will get out of sync.
post #127 of 176
Quote:
Originally Posted by jtappin View Post
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.
FWIW here is a copy of the version of m2tstoavi.fifo that I'm using right now. It uses mencoder as the encoder, and has a -h option for 1920x1080 inputs, 1440x1080 is the default. Use at your own risk, modify it if you need to.

[The extra .txt extension was added to keep the attachment manager happy].

 

m2tstoavi.fifo.txt 1.90234375k . file
post #128 of 176
Hello all,
I just wanted to post my enhanced version of m2tstoavi.fifo file. I have a Canon
Vixia HF-10 and wanted to have just one command to execute to get all the videos
off the camera as well as convert them using m2tstoavi. I would like to thank
jtappin for his bit of code that I used that allows me to select different resolutions
at the command line. I also noticed a bug or 2 in the original m2tstoavi. One of
them was the following at the bottom...
Code:
rm -f $videofifo
rm -f $audiofile
This needed to be in the main foreach loop so that each temp file gets
deleted. Otherwise only the last *.yuv and *.ac3 files in the /tmp directory are deleted.
This could be a disk space issue if you are running m2tstoavi.fifo for multiple .MTS files.

OK, so here is my enhanced versions of 2 of the original files.

First is hdrsr1cp. The only thing I changed was ...
Code:
set sourcedir=/media/CANON/AVCHD/BDMV/STREAM
for the Canon Vixia HF-10 and HF-100

Second was m2tstoavi.fifo
Code:
#!/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.
OH!!! I almost forgot, I also changed the script so that It saves the output AVI files onto the same directory as the input m2ts files. This was simply for convenience.

I hope this can help someone.

Thanks Axel for great conversion scripts.
post #129 of 176
Hello,

So I want to have transcoded video that has audio in sync too! I'm on Gentoo and ldecod doesn't seem to be an available package. I'd be happy to compile it from source, but I'd first like to find out if I really need it. I have been able to successfully transcode using mencoder or ffmpeg but both result in video with the audio way out of sync. Here's the command I'm using:
Code:
/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
I use ls | xargs -n1 to pipe each file into the script.

From some of the posts in this thread I am starting to think it's my -fps and -ofps value that may be causing this, and if so, how do I find out what I should be using or what works?

Also, I get a repeating message during the encoding process:
Quote:
Pos: 15.0s 645f (72%) 13.36fps Trem: 0min 7mb A-V:0.004 [2870:255]
Too many video packets in the buffer: (132 in 8405941 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

If I switch that on (-ni) then the message goes away but my audio still remains out of sync. It also doesn't throw up that warning until about 40-70% of the video has been encoded.

Any thoughts would be appreciated.

My camera is a Canon HF-100.

-Chad
post #130 of 176
Quote:
Originally Posted by MasterCLC View Post

Hello,

So I want to have transcoded video that has audio in sync too! I'm on Gentoo and ldecod doesn't seem to be an available package. I'd be happy to compile it from source, but I'd first like to find out if I really need it. I have been able to successfully transcode using mencoder or ffmpeg but both result in video with the audio way out of sync. Here's the command I'm using:
Code:
/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

Does your camera really work at 60 frames per second?

Try changing the -fps and -ofps settings to 29.97 or 30000/1001 and see what happens then.

Essentially, all these conversion tools handle the video and audio streams separately, and so if either the video frame rate or the audio sampling rate is incorrect then the streams will drift apart.
post #131 of 176
Quote:
Originally Posted by jtappin View Post

Does your camera really work at 60 frames per second?

Try changing the -fps and -ofps settings to 29.97 or 30000/1001 and see what happens then.

Essentially, all these conversion tools handle the video and audio streams separately, and so if either the video frame rate or the audio sampling rate is incorrect then the streams will drift apart.

Going along with this, remember that 60fps is not a real frame rate. There are a few AVCHD cameras that do "30p" or "60p" (depending on marketing) but those values are really 59.94. More accurately 60000/1001.
post #132 of 176
Hi Guys,

I junked Axel's script and wrote a new one which only needs a recent-ish FFMPEG to work, and which can take greater advantage of multi-processor machines.

Unfortunately since I am new here, I can't paste a link - argh.

The project / download is at: code.google.com/p/hdffxvrt/ and there is a link off that home page to the blog posting.

- alec
post #133 of 176
Quote:
Originally Posted by alecmuffett View Post

Hi Guys,

I junked Axel's script and wrote a new one which only needs a recent-ish FFMPEG to work, and which can take greater advantage of multi-processor machines.

Unfortunately since I am new here, I can't paste a link - argh.

The project / download is at: code.google.com/p/hdffxvrt/ and there is a link off that home page to the blog posting.

- alec

I will be away for a few days, but I will take a look at your scripts. On the surface it looks fine as long you are a PAL user. I might add a few extra flags to improve quality. You might want to update the crypticide link to point to here rather than Vimeo. And no love for me, the mac guy?
post #134 of 176
Hiya!

Yeah, I intend to update the script once I have a few "friends" who can send me samples of material from other cameras - ones which are non-interlaced, have square pixels, are NTSC, and so forth.

Then new/extra/PAL/NTSC commandline options will be forthcoming. I won't release code that I cannot test somehow. :-)

Any quality-improvement tweaks you can suggest will be gratefully considered; after much much pain I have concluded that the only sane way to proceed was add the "complex" options to the backend (re-encoding) of the pipeline - processing otherwise "raw" input; attempting cleverness on the input side of the pipeline seems to involve much greater pain.

- alec :-)
post #135 of 176
Plus: I must say thanks, 0ctane - I read a lot of your stuff in pursuit of solving this problem, and learned/inferred heaps about how things work.
post #136 of 176
Now I have done 3 posts, the URLs should work:

hdffxvrt (HD FFmpeg-based Convert) is available on Google Code at:

http://code.google.com/p/hdffxvrt/

Issues and feature requests can be registered at:

http://code.google.com/p/hdffxvrt/issues/list

...and the blog post where it is announced is at:

http://www.crypticide.com/dropsafe/article/2657

If folks with AVCHD camcorders would like to contact me about getting hdffxvrt to work for their camera configuration, please leave a comment on the blog above and I will be in touch.

I am particularly interested in getting short (15 second?) samples of

1920x1080i PAL
1920x1080i NTSC
1920x1080p PAL
1920x1080p NTSC
1440x1080i NTSC

...which I think would give me the complete set? Does anyone do 1440x1080p?

Thanks, all.

- alec
post #137 of 176
Hello,

Thanks to all who are helping to make AVCHD files work on Linux.

I slightly modified Alec's hdffxvrt script to work with the 1920x1080i files from my NTSC, Canon HF11 (set to 24P).

Basically, I changed the "isize" setting to 1920x1080, I changed both the "irate" and "orate" settings to 60000/1001, and I replaced the "$irate2" variable with plain "$irate" in the ffmpeg command section of the script.

Here is the resulting ffmpeg command produced by the script (not sure if I'm properly notating the intermediate video file and the piping):
Code:
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
It worked wonderfully, but I need to be able to send footage for viewing to clients who use Windows, so I replaced all ".mov" references in the script with ".avi" and tried it. Unfortunately, the video played faster than the audio after this modification. any suggestions for a remedy would be appreciated.

The original mts file and the mov and avi files along with the modified scripts are all available for download here: marks.org/avchd/

I'll keep the files up for a few weeks. I would be happy to shoot test files that anyone might need and post them, too.

In regards to improvements for hdffxvrt, it might be useful to be able to independently specify (with arguments/options) frame rates, input/output frame size, output file names, etc. Of course, any flags that would improve image quality would be welcome.

Please keep up the great work!

-Dale
post #138 of 176
Dale - is there any chance you could supply me a short clip - 10 to 30 seconds - which I could play with ? Is there somewhere you could post such a thing that I might retrieve it?

I would like to get your requirements properly implemented, with commandline switches, etc...

update: whoops, just noticed the URL - I will go pull and have a look, may not be able to get updates until monday.

A short clip would still be welcomed - something where i can see the sound going out of sync :-)

ps: after much experimentation I have decided I rather like:

input.mts -> input.mts.SIZE.mov

as a file naming convention; it´s flexible and makes locking easy.

Is this a problem?
post #139 of 176
thought: do you really want 60000/1001 as an OUTPUT?

UPDATE: Also I ran:

$ ffmpeg -i 00053med.avi
[...]
Seems stream 0 codec frame rate differs from container frame rate: 60000.00 (60000/1) -> 59.94 (60000/1001)

...which is curious; maybe the output rates for AVI are constrained? Or there is a mismatch with the AVI container which needs cleaning up?

(as you may have guessed I am not experienced in AVI :-))
post #140 of 176
Alec,

I would be happy to shoot a clip that has more discernable visual/sound action. In the next few days, I'll try to get a pretty girl to count and clap while the camera rolls.

The file naming scheme that you like is fine. I was just thinking that it might be convenient to make available a switch that would allow one to tailor the file names to one's liking (especially if one doesn't need the file "locking.)"

After reading your question about output frame rates, I also tried output frame rates of 24000/1001, 30000/1001 and 23.98, with the ".mov" version of hdffxvrt.

The overall frame flicker is more noticeable with the output rates of 24000/1001 and 23.98, but the moire' flicker within the harp strings is slower and more pronounced with the 60000/1001 rate. The 30000/1001 rate seems to be a happy "medium" for this clip.

I also ran "ffmpeg -i" on all of these different ".mov" files, and, in each case, there is a mismatch between the "stream 0 codec" frame rate and the container frame rate. So, it seems that this discrepancy is not specific to AVI.

The 30000/1001 file exhibits a 30000 stream 0 codec rate, and the 24000/1001 has a 24000 stream 0 codec frame rate. Curiously, the 23.98 file shows a 1199 stream 0 codec frame rate.
post #141 of 176
Alec,

Sorry for the delay.

I made a file of a girl counting and clapping. It can be found at:
marks.org/avchd/

The file is "00106.mts" and it is about 69Mb.

Again, this was shot on my Canon HF11, set a FP24 (24fps) but recorded at 60i (60000/1001fps?).

Thanks,
-Dale
post #142 of 176
After many hours I got a version of the fifo script to run without errors. But am still not sure that the created avi file is good because subsequent testing of the avi file indicates that the stream frame rate is different from the container frame rate.
I manually compiled and installed xporthdmv and ldecod because I already had mplayer and ffmpeg from SUSE 11.1. I should also mention that my camera is a Cannon Vixia HF100. Here are the basic commands that the script does:

Code:
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
Here is the ffmpeg command and the output:

Code:
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%
The created avi file plays with mplayer but I still wanted to prove that it was good so i tried the following ffmpeg command to null:

Code:
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%
Why is the stream codec frame rate different from the container frame rate? Does this mean that there is a problem with the avi file? I did some research on this message but didn't find anything helpful.

Thanks.
post #143 of 176
Rather than "-r 29.97002997", have you tried "-r ntsc"? The rate you specified is an approximation of 30000/1001 but is not the true frame rate.
post #144 of 176
I found a nice tip on the ubuntuforums, I can't post the link as it thinks I'm a spammer because I'm new to this site.

Essentially it uses one command, and it worked great, I just tried it this morning.

as root or sudo:

Quote:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
./configure
make
make install

Then
Quote:
mencoder 00001.MTS -o 1.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000 -fps 50 -vf scale=1280:720

Worked like a champ for me. I hope this helps!
post #145 of 176
@kilimano
Thank you for the info.

I have a Canon HF11. I get the same error message saying the stream codec frame rate differs from the container frame rate, using Alec's hdffxvrt script. However, in my case, it doesn't appear with just AVI encoding -- it also appears with Quicktime encoding.

I have tried changing frame rate variable (60000/1001, 30000/1001, 59.94, 29.97, etc). If I specify an input rate of 30000/1001 or 29.97, I get slow motion video. On the other hand, an input rate of 60000/1001 or 59.94 yields video at the proper speed. These results seem to contradict ffmpeg's assessment of the original footage as 29.97, but Canon says that the HF11 records footage at 60i.

Also, when I try to make AVIs with any of these settings, the video is always slow motion. However, the Quicktime files are fine.

I have not tried to specifying "ntsc," as Octane suggested (thanks!), and I have not tried just omitting the input and/or output frame rate.

If you are able to eliminate the error message please post an update.

By the way, doesn't the Canon HF100 capture at full 1920x1080? If so, when did your footage become 1440x1080? The transformation appears to have occurred prior to the ffmpeg command, because ffmpeg shows the input stream at 1440x1080.


@linuxcrypt
The mencoder tip is appreciated. It would be great to be able to use this simple command and to add other mencoder filters to make extra tweaks!

Is this the forum you were trying to link?: http://ubuntuforums.org/showthread.p...t=avchd+to+avi

I think that new members can post links merely by excluding the "www" or "http" prefix:
ubuntuforums.org/showthread.php?t=1045153&highlight=avchd+to+avi

-Dale
post #146 of 176
@h-munster

Yup, that sure enough was the link. I'll remember that trick when posting links

If you have any other cool findings let me know.

When I use that mencoder command, I actually changed the "50" for fps to "65" to kind of make up the difference. Otherwise, my exported .avi would come out with the audio and video slightly off sync. I'm still working with it, but for a quick and easy solution it's working quite well.
post #147 of 176
I have a comment for everyone. Isn't the frame rate for 30p and 60i the same? 30p means 30 progressive non-interlaced video fields for a frame rate of 29.97. 60i means 60 interlaced video fields (two on top of each other) for a frame rate of 29.97. So, the frame rate for 30p and 60i is the same. I don't think this has been made clear in this thread. See the wikipedia definition for "frame rate". Somebody correct me if I am wrong.

Quote:


60i (actually 59.94, or 60 x 1000/1001 to be more precise; 60 interlaced fields = 29.97 frames) is the standard video field rate per second that has been used for NTSC television since 1941, whether from a broadcast signal, rented DVD, or home camcorder. (When NTSC color was introduced, the older rate of 60 fields per second was reduced by a factor of 1000/1001 to avoid interference between the chroma subcarrier and the broadcast sound carrier.)

This quote might also explain why the real frame rate is a little less than stated rate (30 verses 29.97). It is the reduction factor of 1000/1001.

Quote:


Rather than "-r 29.97002997", have you tried "-r ntsc"? The rate you specified is an approximation of 30000/1001 but is not the true frame rate.

Using -r ntsc did not make any difference. My avi file still has a difference between the codec frame rate and the container frame rate (see my previous post). Does any one know if this is just an ffmeg warning or does it mean that there is a problem with the video?

Quote:


By the way, doesn't the Canon HF100 capture at full 1920x1080? If so, when did your footage become 1440x1080?

The Canon HF100 has 4 video recording quality modes ( LP SP XP+ FXP). Only FXP records at 1920x1080. All others are at 1440x1080. The video I was processing was recorded at 1440x1080. The size did not change.
post #148 of 176
Quote:
Originally Posted by 0ctane View Post
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?
... well not all of them. just the date and time. for the beginning and the end of the clip. well to be honest, the information is in about every 1000 packet of the stream, but i analyze only the first 100 one to get the beginning and the last 100 one to get the endstamp.

at least this is true for my canon hg-20. tomorrow i'll check my program against a hf-100 and a hf-10.

 

canon_analyze_mts.pl.zip 2.1318359375k . file
post #149 of 176
Making a little progress.

My slight modification to Alec's script works, but ffmpeg doesn't have a lot of filters. I am often shooting 24P on my Canon HF11, so I need a good pull-down removal filter. The hdffxvrt script can't really remove the Canon 24P pull-down -- it just duplicates and drops frames and deinterlaces the video.

The best, open-source pull-down removal filter that I have found for my HF11 24P footage is the "detc" filter in mencoder.

I also need to be able to give files to editors that they can use in Final Cut Pro, and ffmpeg is great for converting formats.

So, the procedure I am trying now is to remove the 24P pull-down in mencoder, and, then, I use ffmpeg to convert the resulting file to the Quicktime format at the desired bitrate.

Here is the mencoder command:
mencoder canon_24p_footage.mts -fps 60000/1001 -oac pcm -demuxer lavf -vf detc,softskip -ofps 24000/1001 -ovc lavc -lavcopts vcodec=ffvhuff:format=YV12:vstrict=-1:aspect=16/9 -o intermediate_file.avi

And I follow-up with this ffmpeg command:
ffmpeg -i intermediate_file.avi -vcodec mpeg4 -b 35000k -f mov -acodec copy final_quicktime_file.mov

Then I remove the intermediate file.

A test run is posted at http://marks.org/avchd/ The test file is ffmpeg05.mov (The original Canon AVCHD footage is also posted on this page -- 00053.mts).

I am doing this manually. It will probably get tedious and time consuming when there are a lot of files to convert. If someone is good at making scripts, I would welcome any help in writing one for this procedure.

In addition, I wonder if it is better/cleaner to use the raw video format in mencoder and, then, pipe that result into ffmpeg.

I was unable to achieve the 35 Mb/s bitrate -- is that a Quicktime limitation? The Canon HF11 AVCHD footage was recorded at 24Mb/s. I would like to encode at 35Mb/s into a format that can be used in Final Cut Pro.

Should I make a 2-pass run of the mencoder command? ... or a 2-pass ffmpeg command?

Any opinions and suggestions are appreciated.

By the way, I also made a smaller AVI file with this method and posted it on the same page (above): "
ffmpeg07.avi".

This message was also posted in a related thread here: https://www.blogger.com/comment.g?bl...5486167&page=1

Thanks,
-Dale
post #150 of 176
Quote:
Originally Posted by h-munster View Post

I also need to be able to give files to editors that they can use in Final Cut Pro, and ffmpeg is great for converting formats.

Under openSUSE-11.1 Linux, I tried playing your files with ffplay on 3 different PCs, and also tried edit/rendering them with kdenlive. I made a note of my efforts here:
http://www.avsforum.com/avs-vb/showt...5#post15976985

In essence, play back of the raw file was poor on all 3 PCs (with an 11-Feb svn version of ffmpeg) but editing/rendering them with the NLE kdenlive worked fine (in a limited test - I tried a few output formats).
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Camcorders
AVS › AVS Forum › Other Areas of Interest › Camcorders › AVCHD .m2ts conversion for Linux