Huh, now that seems tricky one!
Just wanted to say THANK YOU so much for posting this. I was using another program (mts2avi or something like that). I should've been using mencoder all along.
I had the same sync problem and this post solved it.... this is great!
Also, for bash users you can go through a directory with the following:
You can do more I suppose... make a processed directory and put the MTS files there and an output folder to put the .avi files with something like this after the mencoder command:#!/bin/bash
for file in *.MTS
do
outfile=${file%.MTS}.avi
echo $file " " $outfile
mencoder $file -o $outfile -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000 -fps 60000/1001 -vf scale=1280:720
done
Thanks again!mv $file processed
mv $outfile avi
I've recently been trying to play with AVCHD video on Linux out of my Sony HDR-SR7 camera.
I also tried that mts2avi script, without much success. Using mencoder directly seems to work much better.
I ran into the same issue, more or less. I found out I had to manually download and compile mplayer (& mencoder which comes with it), apparently the current mediubuntu-provided version does not work.
The version of mencoder from svn that I've compiled and which works is SVN-r29289-4.3.3.
See the first post of this thread for how to compile mplayer... You will need at least the build-essential and subversion packages installed (maybe others too). Also, it's not absolutely necessary, but probably a good idea to remove the mplayer package before doing the compile.
I also had issues with mencoder giving errors of "Too many video packets in the buffer:" and audio getting out of sync, these were solved by adding "-demuxer lavf" to the mencoder line.
Hope this helps!
Last edited by Wizzu; May 11th, 2009 at 06:07 AM.
I am facing a different problem - compilation issue.
When I checkout the latest version of mplayer. ./configure works fine, but when I run make, I get the errors below after about 10 minutes of compilation (I have build-essential installed).
Can asomeone please tell me what I'm doing wrong here? (Incidentally I'm running a 32 bit version of Ubuntu 9.04)
Error dump:
Code:cc -DHAVE_AV_CONFIG_H -I.. -I.. -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdread4 -I. -D_REENTRANT -c -o lcldec.o lcldec.c lcldec.c:50:18: error: zlib.h: No such file or directory lcldec.c:70: error: expected specifier-qualifier-list before 'z_stream' lcldec.c: In function 'zlib_decomp': lcldec.c:131: warning: implicit declaration of function 'inflateReset' lcldec.c:131: error: 'LclDecContext' has no member named 'zstream' lcldec.c:132: error: 'Z_OK' undeclared (first use in this function) lcldec.c:132: error: (Each undeclared identifier is reported only once lcldec.c:132: error: for each function it appears in.) lcldec.c:136: error: 'LclDecContext' has no member named 'zstream' lcldec.c:137: error: 'LclDecContext' has no member named 'zstream' lcldec.c:138: error: 'LclDecContext' has no member named 'zstream' lcldec.c:139: error: 'LclDecContext' has no member named 'zstream' lcldec.c:140: warning: implicit declaration of function 'inflate' lcldec.c:140: error: 'LclDecContext' has no member named 'zstream' lcldec.c:140: error: 'Z_FINISH' undeclared (first use in this function) lcldec.c:141: error: 'Z_STREAM_END' undeclared (first use in this function) lcldec.c:145: error: 'LclDecContext' has no member named 'zstream' lcldec.c:147: error: 'LclDecContext' has no member named 'zstream' lcldec.c:150: error: 'LclDecContext' has no member named 'zstream' lcldec.c: In function 'decode_init': lcldec.c:544: error: 'Z_NO_COMPRESSION' undeclared (first use in this function) lcldec.c:544: error: 'Z_BEST_COMPRESSION' undeclared (first use in this function) lcldec.c:580: error: 'LclDecContext' has no member named 'zstream' lcldec.c:580: error: 'Z_NULL' undeclared (first use in this function) lcldec.c:581: error: 'LclDecContext' has no member named 'zstream' lcldec.c:582: error: 'LclDecContext' has no member named 'zstream' lcldec.c:583: warning: implicit declaration of function 'inflateInit' lcldec.c:583: error: 'LclDecContext' has no member named 'zstream' lcldec.c:584: error: 'Z_OK' undeclared (first use in this function) lcldec.c: In function 'decode_end': lcldec.c:609: warning: implicit declaration of function 'inflateEnd' lcldec.c:609: error: 'LclDecContext' has no member named 'zstream' make[1]: *** [lcldec.o] Error 1 make[1]: Leaving directory `/home/akash/mplayer/libavcodec' make: *** [libavcodec/libavcodec.a] Error 2 akash@lenovo:~/mplayer$
Looks like you're missing zlib headers (at least). Check to see if you have the zlib1g-dev (or zlib1-dev) package installed, as well as zlib1g (or zlib1). You might be missing other -dev packages too that mplayer requires to compile, this being just the first of such error that you run into. If that's the case, check the mplayer documentation for a list of required packages (software) to build. build-essential is not enough in itself for mplayer, it just means you can build software in general.
I would imagine configure is meant to handle this stuff and complain if something required is missing, strange that it doesn't.
Thanks a lot, Wizzu. As configure went smoothly without complaining, I was wondering if I had messed up somewhere. Anyway, including zlib1g-dev did the trick.
For the benefit of those who might run into this, you will need build-essential, subversion and zlib1g-dev for compilation to succeed (on a clean Ubuntu Jaunty install).
Cheers!Code:sudo apt-get install build-essential subversion zlib1g-dev
Thank you all for the great solution! I found using m2ts2avi a bit strange and never got the results I wanted. Basically the sound was gone/deformed and the picture was totally mashed. With this everything is in sync and well done Thanks!
I think I have been trying to solve the same problem using ffmpeg - without much success - you can read about my efforts here
Have tried the mencoder commands and am getting the same segmentation error.
I am using MEncoder 2:1.0~rc2-0ubuntu19 on 64bit Ubuntu 9.04Code:[h264 @ 0xe271a0]MBAFF + spatial direct mode is not implemented [h264 @ 0xe271a0]concealing 3060 DC, 3060 AC, 3060 MV errors Pos: 20.2s 1013f (100%) 14.92fps Trem: 0min 25mb A-V:0.020 [10002:448] Flushing video frames. Writing index... Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Video stream: 10002.628 kbit/s (1250328 B/s) size: 25281643 bytes 20.220 secs 1013 frames Audio stream: 448.000 kbit/s (56000 B/s) size: 1134336 bytes 20.256 secs Segmentation fault
I have tried to follow uhappo's instructions to install mplayer & mendocer from svn and build from source. But I haven't built software form source before and I can't seem to get this to work.
Could someone jot down an idiots step by step guide to doing this - or point me in the right direction. Do I need to remove the installed mplayer first? Where should I make and install the new version on my system - my home directory? Where do I put the codecs uhappo linked to (http://www.mplayerhq.hu/design7/dload.html)?
Thanks!
I am getting the same errors as mashedbear:
[h264 @ 0xe271a0]MBAFF + spatial direct mode is not implemented
[h264 @ 0xe271a0]concealing 3060 DC, 3060 AC, 3060 MV errors
Any help would be much appreciated!
Can someone here explain to me these "duplicate frame(s)!" errors? I googled the error messages, but I lack the technical knowledge and I can't understand them.
Thank you.
Code:zombie@ubuntu:~/Videos$ mencoder 00001.MTS -o 1.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000 -fps 50 -vf scale=1280:720 MEncoder SVN-r29851-4.4.1 (C) 2000-2009 MPlayer Team success: format: 0 data: 0x0 - 0x26adc800 TS file format detected. VIDEO H264(pid=4113) AUDIO A52(pid=4352) NO SUBS (yet)! PROGRAM N. 1 FPS seems to be: 29.970030 [V] filefmt:29 fourcc:0x10000005 size:0x0 fps:29.970 ftime:=0.0334 Input fps will be interpreted as 50.000 instead. ========================================================================== Opening audio decoder: [liba52] AC3 decoding with liba52 Using SSE optimized IMDCT transform Using MMX optimized resampler AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000) Selected audio codec: [a52] afm: liba52 (AC3-liba52) ========================================================================== Opening video filter: [expand osd=1] Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0 Opening video filter: [scale w=1280 h=720] ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=32000 sample-1) Movie-Aspect is 1.78:1 - prescaling to correct movie aspect..000 [0:0] [swscaler @ 0xa280310]BICUBIC scaler, from yuv420p to yuv420p using MMX2 videocodec: libavcodec (1280x720 fourcc=34504d46 [FMP4]) Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Writing header... ODML: Aspect information not (yet?) available or unspecified, not writing vprp header. Pos: 0.0s 3f ( 0%) 0.00fps Trem: 4min 77mb A-V:0.004 [0:0] 1 duplicate frame(s)! Pos: 0.0s 4f ( 0%) 0.00fps Trem: 4min 77mb A-V:0.006 [0:0] 1 duplicate frame(s)! Pos: 0.1s 5f ( 0%) 0.00fps Trem: 4min 77mb A-V:0.008 [0:0] 1 duplicate frame(s)! Pos: 0.1s 6f ( 0%) 0.00fps Trem: 4min 77mb A-V:0.006 [0:0] 1 duplicate frame(s)! Pos: 0.1s 7f ( 0%) 0.00fps Trem: 5min 77mb A-V:0.006 [0:0] 1 duplicate frame(s)! Pos: 0.1s 8f ( 0%) 0.00fps Trem: 5min 77mb A-V:0.008 [0:0] 1 duplicate frame(s)! Pos: 0.1s 9f ( 0%) 0.00fps Trem: 6min 77mb A-V:0.010 [0:0] 1 duplicate frame(s)! Pos: 0.2s 11f ( 0%) 0.00fps Trem: 7min 91mb A-V:0.014 [0:0] 1 duplicate frame(s)! [h264 @ 0xa27f8a0]left block unavailable for requested intra mode at 0 16 [h264 @ 0xa27f8a0]error while decoding MB 0 16, bytestream (24406)
Bookmarks