Log in

View Full Version : AVCHD to MPEG2


Mr. Vage
6th July 2008, 04:36
I've spent months trying to solve what I thought would be a simple problem. I have a Sony HDR-SR1 which records to AVCHD as an MPEG2 Transport Stream. I want to convert these files to play on my Roku HD1000 Photobridges. The HD1000 can only play MPEG2 files, so that is my only option to encode the files as.

What I've come up with so far is as follows:


Use xport to demux the m2ts into an avc file and an ac3 file
Use DGAVCIndex on the avc file to create a dga file (I have no idea what this step is for, but it seems to be necessary)
Create an avisynth file to put the video and audio back together as well as deinterlace the video and give it the proper widescreen resolution (see below for avisynth script)
Use ffmpeg to create mpeg2 video file (this is the part that's giving me trouble)


Avisyth script:
loadplugin("dgavcdecode.dll")
load_stdcall_plugin("yadif.dll")
video=AVCSource("myvid.dga")
audio=DirectShowSource("myvid.ac3")
AudioDub(video, audio)
yadif()
Lanczos4Resize(1920, 1080)

What options do I need to set for ffmpeg to output an mpeg2 video correctly?

If i use: ffmpeg -i myvid.avs -target ntsc-dvd -s hd1080 myvid-dvd.mpg, I get a working mpeg2 video at 1920x1080 with ac3 audio. The problem with that setting is the low bitrate of the dvd option causes the video to look terrible.

I've tried ffmpeg -i myvid.avs -vcodec mpeg2video -b 15000k -acodec ac3 -ab 224000 myvid-hd.mpg and various other variations of this, but if i don't get errors, I end up with a black video (that gspot and MPC say is mpeg1) and no audio.

I am so confused as to what I could be doing wrong!

:confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused:

45tripp
6th July 2008, 05:46
first kill audio import into avisynth,
just use the original audio


loadplugin("dgavcdecode.dll")
load_stdcall_plugin("yadif.dll")
AVCSource("myvid.dga")
yadif()
Lanczos4Resize(1920, 1080)

then you might try this:


ffmpeg -i myvid.avs -i myvid.ac3 -vcodec mpeg2video -acodec copy -qscale 3 -g 14 -mbd 2 \
-flags trell -maxrate 20000k -bufsize 9781k -f vob myvid-hd.mpg

another good idea is to try HCenc to do the encoding.
then mux video, audio.


tripp

florinandrei
17th July 2008, 03:38
There's a thread concerning exactly this topic in the AviSynth forum:

http://forum.doom9.org/showthread.php?t=139102

Basically, scale the image with AviSynth, convert to MPEG2 with HCenc. It's easy to do it quickly and wrong. It's hard to do it right, at a high quality.