Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Mythtvnz

Transcoding HD videos

 

 

MythTV mythtvnz RSS feed   Index | Next | Previous | View Threaded


pshem.k at gmail

Apr 22, 2012, 1:52 AM

Post #1 of 12 (1574 views)
Permalink
Transcoding HD videos

Hi All,

I was wondering if anyone transcodes Freeview|HD stuff into something
less diskspace hungry? I came up with the following set of parameters
for ffmpeg for HD material (1080 to 720 and reducing the bitrate to
about 3.5Mb/s from original 10-11Mb/s, retaining the orginal mpegts
format and removing 'unknown' streams):

ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
-c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 1 -f
rawvideo -an -y /dev/null
ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
-c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 2 -f
mpegts /data/mythtv/store/4003_20100206192900.mpg.new

(after that I use mythcommflag --rebuild to rebuild the index so myth
can play it)

Unfortunately every now and then (roughly every 5-10 minutes) the
scene change is not smooth, as if the key frame got missed. It's not
terrible, but decreases the WAF a little bit every time it happens.
Anyone doing this sort of transcoding? If so - what do you use?

kind regards
Pshem

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


mythicalbeast at slingshot

Apr 23, 2012, 3:30 AM

Post #2 of 12 (1522 views)
Permalink
Re: Transcoding HD videos [In reply to]

> ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
> -c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 1 -f
> rawvideo -an -y /dev/null
> ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
> -c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 2 -f
> mpegts /data/mythtv/store/4003_20100206192900.mpg.new
>
> (after that I use mythcommflag --rebuild to rebuild the index so myth
> can play it)
>
> Unfortunately every now and then (roughly every 5-10 minutes) the
> scene change is not smooth, as if the key frame got missed. It's not
> terrible, but decreases the WAF a little bit every time it happens.
> Anyone doing this sort of transcoding? If so - what do you use?
>
> kind regards
> Pshem
>
That cmd makes progressive encoded .. if you can make it work..

With a recent ffmpeg build I had to change it to this:

ffmpeg -i /recordings/1003_20100215193000.mpg -c:v:0 libx264 -flags
+ilme+ildct -s 1280x720 -b:v 3500k -c:a libfaac -b:a 128K -map 0:0 -map
0:1 -bsf:v h264_mp4toannexb -f mpegts new.mpg

interlaced ts stream file with latm-aac--> libfaac acc
MythTV plays it okay
mediainfo seems okay
old VLC 1.0.6 will not play video..



_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


pshem.k at gmail

Apr 23, 2012, 1:09 PM

Post #3 of 12 (1516 views)
Permalink
Re: Transcoding HD videos [In reply to]

Hi,
>>
> That cmd makes progressive encoded .. if you can make it work..

That was the key word here. I realised I was generating 720p with
50fps, adding -r 25 to the output file did the trick. The filter
(h264_mp4toannexb) also helps.
One thing I've noticed every now and then ffmpeg will segfault at the
end of encoding, but the movie remains playable.


> With a recent ffmpeg build I had to change it to this:
>
> ffmpeg -i /recordings/1003_20100215193000.mpg  -c:v:0 libx264 -flags
> +ilme+ildct -s 1280x720 -b:v 3500k -c:a libfaac -b:a 128K  -map 0:0 -map
> 0:1 -bsf:v h264_mp4toannexb -f mpegts new.mpg
>
> interlaced ts stream file with latm-aac--> libfaac acc

> MythTV plays it okay
> mediainfo seems okay
> old VLC  1.0.6 will not play video..

I've noticed that mplayer has issues playing it too if the framerate
is not reduced to 25fps.

Thx for the input.

kind regards
Pshem

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


steven at openmedia

Apr 23, 2012, 4:57 PM

Post #4 of 12 (1522 views)
Permalink
Re: Transcoding HD videos [In reply to]

On Tue, April 24, 2012 8:09 am, Pshem Kowalczyk wrote:
> Hi,
>>>
>> That cmd makes progressive encoded .. if you can make it work..
>
> That was the key word here. I realised I was generating 720p with
> 50fps, adding -r 25 to the output file did the trick. The filter
> (h264_mp4toannexb) also helps.
> One thing I've noticed every now and then ffmpeg will segfault at the
> end of encoding, but the movie remains playable.
>
>
>> With a recent ffmpeg build I had to change it to this:
>>
>> ffmpeg -i /recordings/1003_20100215193000.mpg  -c:v:0 libx264 -flags
>> +ilme+ildct -s 1280x720 -b:v 3500k -c:a libfaac -b:a 128K  -map 0:0
>> -map
>> 0:1 -bsf:v h264_mp4toannexb -f mpegts new.mpg
>>
>> interlaced ts stream file with latm-aac--> libfaac acc
>
>> MythTV plays it okay
>> mediainfo seems okay
>> old VLC  1.0.6 will not play video..
>
> I've noticed that mplayer has issues playing it too if the framerate
> is not reduced to 25fps.
>
> Thx for the input.
>
> kind regards



Are you guys also editing the HD Videos as well?



_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


pshem.k at gmail

Apr 23, 2012, 6:23 PM

Post #5 of 12 (1527 views)
Permalink
Re: Transcoding HD videos [In reply to]

On 24 April 2012 11:57, Steven Ellis <steven [at] openmedia> wrote:

{cut}

> Are you guys also editing the HD Videos as well?

I don't edit them at all. The only purpose of transcoding is to save space.

kind regards
Pshem

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


dmoo1790 at ihug

Apr 23, 2012, 8:38 PM

Post #6 of 12 (1513 views)
Permalink
Re: Transcoding HD videos [In reply to]

On 24/04/2012, at 1:23 PM, Pshem Kowalczyk <pshem.k [at] gmail> wrote:

> On 24 April 2012 11:57, Steven Ellis <steven [at] openmedia> wrote:
>
> {cut}
>
>> Are you guys also editing the HD Videos as well?
>
> I don't edit them at all. The only purpose of transcoding is to save space.
>
> kind regards
> Pshem
>
What hardware are you running and how long does it take to transcode a movie?

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


pshem.k at gmail

Apr 23, 2012, 11:39 PM

Post #7 of 12 (1514 views)
Permalink
Re: Transcoding HD videos [In reply to]

Hi,

{cut}

> What hardware are you running and how long does it take to transcode a movie?

AMD Athlon(tm) II X4 @2.6Ghz - using two pass encoding for HD I can
get about 35fps for the first pass and about 15fps for second, using 3
threads in ffmpeg. So roughly 2.5h to transcode 1h of movie.

kind regards
Pshem

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


mythicalbeast at slingshot

Apr 24, 2012, 2:20 AM

Post #8 of 12 (1517 views)
Permalink
Re: Transcoding HD videos [In reply to]

On Tue, 2012-04-24 at 08:09 +1200, Pshem Kowalczyk wrote:
> Hi,
> >>
> > That cmd makes progressive encoded .. if you can make it work..
>
> That was the key word here. I realised I was generating 720p with
> 50fps, adding -r 25 to the output file did the trick. The filter
> (h264_mp4toannexb) also helps.
> One thing I've noticed every now and then ffmpeg will segfault at the
> end of encoding, but the movie remains playable.
>
>
> > With a recent ffmpeg build I had to change it to this:
> >
> > ffmpeg -i /recordings/1003_20100215193000.mpg -c:v:0 libx264 -flags
> > +ilme+ildct -s 1280x720 -b:v 3500k -c:a libfaac -b:a 128K -map 0:0 -map
> > 0:1 -bsf:v h264_mp4toannexb -f mpegts new.mpg
> >
> > interlaced ts stream file with latm-aac--> libfaac acc
>
> > MythTV plays it okay
> > mediainfo seems okay
> > old VLC 1.0.6 will not play video..
>
> I've noticed that mplayer has issues playing it too if the framerate
> is not reduced to 25fps.
>
The keywords for interlaced encoding support in x264 are:
-flags +ilme+ildct


_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


mythicalbeast at slingshot

Apr 24, 2012, 2:40 AM

Post #9 of 12 (1511 views)
Permalink
Re: Transcoding HD videos [In reply to]

>
> Are you guys also editing the HD Videos as well?
>
Work in progress (ice-age slow) so no, not yet.

I would like to be able to use a user-job with the std myth cutlists.
I think that time based cutlists could be better for fast
seeking/cutting.

AFAIK
avidemux
- supports cutlists
- still no latm-aac support
- 2.5 was frame based, 2.6 is time based, both are flakey IMO.

mkvtoolnix
- supports time cutlists by splitting file, cuts to I frame.
- no latm-aac support.
- mkv output only (fine).

ffmpeg
- can be scripted to cut in one pass with cutlist
- frame accurate cutting requires video filter i.e. decode & slow

Converting ts to ps & (theoretically) stripping filler NALs could save
10% to 40%.

I have read that mkvmerge strips filler/stuffing NALs & ffmpeg does
not..but I have not noticed any size reduction by processing with
mkvmerge.

Brett


_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


dmoo1790 at ihug

Apr 24, 2012, 3:39 AM

Post #10 of 12 (1514 views)
Permalink
Re: Transcoding HD videos [In reply to]

On 24/04/2012, at 9:40 PM, Brett <mythicalbeast [at] slingshot> wrote:

>
>>
>> Are you guys also editing the HD Videos as well?
>>
> Work in progress (ice-age slow) so no, not yet.
>
> I would like to be able to use a user-job with the std myth cutlists.
> I think that time based cutlists could be better for fast
> seeking/cutting.
>
> AFAIK
> avidemux
> - supports cutlists
> - still no latm-aac support
> - 2.5 was frame based, 2.6 is time based, both are flakey IMO.
>
> mkvtoolnix
> - supports time cutlists by splitting file, cuts to I frame.
> - no latm-aac support.
> - mkv output only (fine).
>
> ffmpeg
> - can be scripted to cut in one pass with cutlist
> - frame accurate cutting requires video filter i.e. decode & slow
>
> Converting ts to ps & (theoretically) stripping filler NALs could save
> 10% to 40%.
>
> I have read that mkvmerge strips filler/stuffing NALs & ffmpeg does
> not..but I have not noticed any size reduction by processing with
> mkvmerge.
>
> Brett
>
>
I wrote a crude but fast script (gist.github.com/508582) which cuts files using the cutlist. Not glitch-free sometimes at the cut points. Haven't used it for ages since the really time-consuming thing is making the cut list because no auto method is 100% reliable.
_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


mythicalbeast at slingshot

Apr 24, 2012, 10:33 PM

Post #11 of 12 (1493 views)
Permalink
Re: Transcoding HD videos [In reply to]

> >
> >
> I wrote a crude but fast script (gist.github.com/508582) which cuts files using the cutlist. Not glitch-free sometimes at the cut points. Haven't used it for ages since the really time-consuming thing is making the cut list because no auto method is 100% reliable.
> _______________________________________________
Thank you for posting this again.

Very pragmatic using dd on transport stream file..

mkvmerge -split can utilise bytes/time/timecodes & re-join the "keep"
pieces. But mkvtoolnix does not handle latm-aac or input pipe so need an
intermediate file with latm-->aac etc.



_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/


nick.rout at gmail

Apr 28, 2012, 9:55 PM

Post #12 of 12 (1431 views)
Permalink
Re: Transcoding HD videos [In reply to]

On Sun, Apr 22, 2012 at 8:52 PM, Pshem Kowalczyk <pshem.k [at] gmail> wrote:
> Hi All,
>
> I was wondering if anyone transcodes Freeview|HD stuff into something
> less diskspace hungry? I came up with the following set of parameters
> for ffmpeg for HD material (1080 to 720 and reducing the bitrate to
> about 3.5Mb/s from original 10-11Mb/s, retaining the orginal mpegts
> format and removing 'unknown' streams):
>
> ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
> -c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 1 -f
> rawvideo -an -y /dev/null
> ffmpeg -i /data/mythtv/store/4003_20100206192900.mpg -threads 3 -map 0
> -c copy -c:v:0 libx264 -s 1280x720 -map -0:3 -b:v 3500k -pass 2 -f
> mpegts /data/mythtv/store/4003_20100206192900.mpg.new
>
> (after that I use mythcommflag --rebuild to rebuild the index so myth
> can play it)
>
> Unfortunately every now and then (roughly every 5-10 minutes) the
> scene change is not smooth, as if the key frame got missed. It's not
> terrible, but decreases the WAF a little bit every time it happens.
> Anyone doing this sort of transcoding? If so - what do you use?
>
> kind regards
> Pshem
>

I understand current x264 best practice is to use constant quality
with one pass. Seems to be what they suggest on doom9 and similar
forums.

whether it applies to the files we are dealing with is unknown to me.

_______________________________________________
mythtvnz mailing list
mythtvnz [at] lists
http://lists.ourshack.com/mailman/listinfo/mythtvnz
Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/

MythTV mythtvnz RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.