Avidemux Forum

Avidemux => Unix-Like (Linux/Bsd/...) => Topic started by: Vonhonk on April 01, 2013, 09:27:53 AM

Title: x264/mp4 problem
Post by: Vonhonk on April 01, 2013, 09:27:53 AM
I have a Samsung LCD TV, which has a USB-port I can use to watch movies. Using just an USB-stick has been very convenient for several reasons. I have used Avidemux to encode the files to AVI. Unfortunately, I had a lot of A/V-sync problems, so I moved to mp4, which I was told to be a better container for my purposes. It worked like a charm, I got rid of all the problems I had. For a few years everything went OK, I used h264 for video and AAC for audio. I had noticed my TV is sometimes very picky about the right codecs, because even when the mp4 file info says the codecs are right, the TV wouldn't play the file. It either does not recognize the codec (ââ,¬Å"unsupportedââ,¬Â) or just crashes, creating a coredump. This was the case for the mp4s I recorded with my Nokia phone. Even so, encoding them again with Avidemux worked fine. Last year something changed. My TV was not able to show any of the mp4s I created  just the way I did it previously. I had now some time to play around the codecs and containers, so I noticed something works.

This is what their manual says:

(https://avidemux.org/smif/proxy.php?request=http%3A%2F%2Fimg339.imageshack.us%2Fimg339%2F4062%2Fscreenshotfrom201304011.png&hash=dfc4334f6f021eb608d0cc5bee8ac659d20f0558)

What works or does not work:
AVI
xvid: did not find this one (yes, I know that MPEG-4 ASP is xvid).
MPEG2 & AC3: works
H264 & AC3: works
MPEG-4 ASP & AC3: does not work
MP4
H264 & AAC: does not work
MPEG-4 ASP & AAC: does not work
PS
N/A
TS
MPEG2 & AC3: works

I'm mainly interested in the HD (1920x1088) formats. As you can see, right now I seem to have just two options, AVI or TS. The problem with TS is the size: a two-hour movie is easily a 7 GB in size. 4 GB is the upper limit, since my TV does not support NTFS format. I did a two pass encoding to reduce the size to 2 GB for one movie, but there were a lot of pixelation artifacts. I am using AVI right now, but I'm anticipating those A/V-sync problems to show up at some point.

My questions are:
- How come the h264 codec works for AVI but not for mp4?
- What happened to the mp4 encoding or h264 last year? Did you change something?
- Is there any way to compress the TS file without getting pixelation?

Cheers!
Title: Re: x264/mp4 problem
Post by: Jan Gruuthuse on April 01, 2013, 11:51:36 AM
You did not state your Samsung model. Check if this one runs on your flatscreen:
NHK 1920x1080 sample (http://rapidshare.com/files/758111860/1920by1080Samsung.mkv) 2.2 MB download runs on ue40b8000.
Obtained with these attached settings (could be needed some more tweaking):
On ubuntu you could copy this to ~/.avidemux6/custom/ and then use these settings when video is loaded from main menu: Custom.
Windows 2000 and XP: \Documents and Settings\$USER$\Local Settings\Application Data\avidemux\custom
Windows Vista: \Users\$USER$\AppData\Roaming\avidemux\custom
Title: Re: x264/mp4 problem
Post by: styrol on April 01, 2013, 12:31:31 PM
Which version of Avidemux do you use? MP4 format version?
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 01, 2013, 01:48:05 PM
QuoteYou did not state your Samsung model
This one: LE-52A866
http://www.samsung.com/uk/support/model/LE52A866S1WXXE-downloads?isManualDownload=true (http://www.samsung.com/uk/support/model/LE52A866S1WXXE-downloads?isManualDownload=true)
QuoteCheck if this one runs on your flatscreen:
NHK 1920x1080 sample 2.2 MB download runs on ue40b8000.
Nope. It's Matroska, only AVI/MP4/TS/PS works. Firmware update is not an option.
QuoteWhich version of Avidemux do you use?
[Vonhonk@Host-001 ~]$ rpm -qa | grep avidemux
avidemux-cli-2.6.1-1.fc18.x86_64
avidemux-2.6.1-1.fc18.x86_64
avidemux-devel-2.6.1-1.fc18.x86_64
avidemux-help-2.6.1-1.fc18.noarch
avidemux-qt-2.6.1-1.fc18.x86_64
avidemux-debuginfo-2.6.1-1.fc18.x86_64
avidemux-libs-2.6.1-1.fc18.x86_64
QuoteMP4 format version?
How can you determine it?

Title: Re: x264/mp4 problem
Post by: styrol on April 01, 2013, 06:57:03 PM
QuoteMP4 format version? How can you determine it?
Well, there are two versions under the Output Format selection drop down menu: MP4 muxer, MP4v2 muxer.
Have you tried MP4v2?
And update to a more recent version of Avidemux.
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 01, 2013, 08:59:46 PM
None of these work. And 2.6.1.1. seems to be the most recent version I can update to.
Title: Re: x264/mp4 problem
Post by: Jan Gruuthuse on April 02, 2013, 07:04:25 AM
Samsung does some weird stuff in their mediaplayer. As for now I don't find away to create mp4 that play on my Samsungs here.
You need to find 1920x1080 mp4 that play on your LE-52A866. Once you have these then figure away to obtain the same result with avidemux?
MediaInfo (http://mediainfo.sourceforge.net/en) can give you some details on the video playing. I know resolution could be an issue for accepting video to play on samsung or not in combination with used video codec and audio codec. As differences are to big between le-52A and ue40b8000/LE40B650 most likely I won't find a solution for playing 1920x1080 on your model.
The 4GB restriction is due to FAT32 format. Try with NTFS formated usb media perhaps LE-52A866 supports this format. That said, you never know with samsung.
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 02, 2013, 04:39:24 PM
QuoteYou need to find 1920x1080 mp4 that play on your LE-52A866. Once you have these then figure away to obtain the same result with avidemux?
Will do. Might try with a lower resolution, just to see what happens.
QuoteTry with NTFS formated usb media perhaps LE-52A866 supports this format.
Tried, does not work.

Anyway, I'll look up an HD mp4, that it will play and get back.

Thanks for your comments.
Title: Re: x264/mp4 problem
Post by: Jan Gruuthuse on April 02, 2013, 08:40:58 PM
Samsung LED black Contrast Full HD 1080p h.264.mp4 (http://rapidshare.com/files/47237272/Samsung%20LED%20black%20Contrast%20-%20Full%20HD%201080p%20h.264.mp4)
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 04, 2013, 04:14:58 PM
QuoteSamsung LED black Contrast Full HD 1080p h.264.mp4
Now this is weird. This file shows up OK. But when I do a conversion with Avidemux with just a mp4-version2 copy of the audio and videostream, Samsung won't show it. I compared these two files, the original and reproduced, the only difference is that the overall bitrate for original is 3492 kbps and the copy is 3494 kbps. The original is 30,433,758 bytes and the copy 30,434,754 bytes. Can it be true that the Avidemux is cutting 4 bytes from somewhere and therefore my TV won't show it?
Title: Re: x264/mp4 problem
Post by: styrol on April 04, 2013, 04:37:29 PM
Quote from: Vonhonk on April 04, 2013, 04:14:58 PM
Can it be true that the Avidemux is cutting 4 bytes from somewhere and therefore my TV won't show it?
You did the comparison using MediaInfo in expert view? I assume Avidemux has changed some header info.
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 04, 2013, 04:52:37 PM
Which expert view? I just compared the sizes. And which headers? This is pissing me off!!!
Title: Re: x264/mp4 problem
Post by: styrol on April 04, 2013, 06:33:20 PM
http://pastebin.com/32VhShdr
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 05, 2013, 06:05:48 AM
Quotehttp://pastebin.com/32VhShdr
In other words, you would like to see similar kind of output from mediainfo for both of these files?
Title: Re: x264/mp4 problem
Post by: styrol on April 05, 2013, 07:34:30 AM
Quote from: Jan Gruuthuse on April 02, 2013, 07:04:25 AM
MediaInfo (http://mediainfo.sourceforge.net/en) can give you some details on the video playing. I know resolution could be an issue for accepting video to play on samsung or not in combination with used video codec and audio codec.
Quote from: Vonhonk on April 05, 2013, 06:05:48 AM
In other words, you would like to see similar kind of output from mediainfo for both of these files?
It's the only way to goââ,¬Â¦ (we may see if variable frame rate is the problem)
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 06, 2013, 06:24:53 AM
OK, here we go. This works:

[Vonhonk@Host-001 Downloads]$ mediainfo 'Samsung LED black Contrast - Full HD 1080p h.264.mp4'
General
Complete name                      : Samsung LED black Contrast - Full HD 1080p h.264.mp4
Format                                   : MPEG-4
Format profile                         : Base Media / Version 2
Codec ID                                : mp42
File size                                  : 29.0 MiB
Duration                                  : 1mn 9s
Overall bit rate mode               : Variable
Overall bit rate                        : 3 492 Kbps
Encoded date                          : UTC 2010-07-26 22:28:33
Tagged date                            : UTC 2010-07-26 22:28:33
gsst                                         : 0
gstd                                         : 69715
gssd                                        : B4A7D6344MH1310024999647633
gshh                                        : v9.nonxt5.c.youtube.com

Video
ID                                            : 1
Format                                     : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC           : No
Format settings, ReFrames        : 1 frame
Format settings, GOP                : M=1, N=30
Codec ID                                   : avc1
Codec ID/Info                             : Advanced Video Coding
Duration                                     : 1mn 9s
Bit rate                                       : 3 358 Kbps
Maximum bit rate                        : 10.9 Mbps
Width                                          : 1 920 pixels
Height                                         : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                         : Variable
Frame rate                                   : 29.970 fps
Original frame rate                       : 29.917 fps
Minimum frame rate                     : 29.412 fps
Maximum frame rate                    : 200.000 fps
Color space                                  : YUV
Chroma subsampling                    : 4:2:0
Bit depth                                       : 8 bits
Scan type                                      : Progressive
Bits/(Pixel*Frame)                         : 0.054
Stream size                                   : 27.9 MiB (96%)
Tagged date                                  : UTC 2010-07-26 22:28:34

Audio
ID                                                  : 2
Format                                           : AAC
Format/Info                                    : Advanced Audio Codec
Format profile                                 : LC
Codec ID                                        : 40
Duration                                         : 1mn 9s
Bit rate mode                                  : Variable
Bit rate                                           : 128 Kbps
Maximum bit rate                            : 184 Kbps
Channel(s)                                      : 2 channels

Channel positions                            : Front: L R
Sampling rate                                  : 44.1 KHz
Compression mode                          : Lossy
Stream size                                     : 1.06 MiB (4%)
Title                                                 : (C) 2007 Google Inc. v08.13.2007.
Encoded date                                   : UTC 2010-07-26 22:28:34
Tagged date                                     : UTC 2010-07-26 22:28:34

And this, Avidemux encoded version doesn't, even though the A/V streams are a copy:

[Vonhonk@Host-001 Downloads]$ mediainfo 'Samsung LED black Contrast - Full HD 1080p h.264-2.mp4'
General
Complete name:                     : Samsung LED black Contrast - Full HD 1080p h.264-2.mp4
Format                                   : MPEG-4
Format profile                          : Base Media / Version 2
Codec ID                                 : mp42
File size                                   : 29.0 MiB
Duration                                   : 1mn 9s
Overall bit rate mode                : Variable
Overall bit rate                          : 3 494 Kbps
Encoded date                            : UTC 2013-04-04 15:54:02
Tagged date                              : UTC 2013-04-04 15:54:03

Video
ID                                            : 1
Format                                     : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC           : No
Format settings, ReFrames       : 1 frame
Format settings, GOP               : M=1, N=30
Codec ID                                  : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                    : 1mn 9s
Bit rate mode                            : Variable
Bit rate                                      : 3 358 Kbps
Width                                        : 1 920 pixels
Height                                        : 1 080 pixels
Display aspect ratio                    : 16:9
Frame rate mode                        : Variable
Frame rate                                  : 29.970 fps
Original frame rate                      : 29.917 fps
Minimum frame rate                    : 29.402 fps
Maximum frame rate                   : 200.000 fps
Color space                                 : YUV
Chroma subsampling                   : 4:2:0
Bit depth                                      : 8 bits
Scan type                                     : Progressive
Bits/(Pixel*Frame)                         : 0.054
Stream size                                  :  27.9 MiB (96%)
Encoded date                               : UTC 2013-04-04 15:54:02
Tagged date                                  : UTC 2013-04-04 15:54:03

Audio
ID                                           : 2
Format                                   : AAC
Format/Info                             : Advanced Audio Codec
Format profile                         : LC
Codec ID                                : 40
Duration                                 : 1mn 9s
Bit rate mode                          : Variable
Bit rate                                    : 128 Kbps
Channel(s)                               : 2 channels
Channel positions                    : Front: L R
Sampling rate                          : 44.1 KHz
Compression mode                   : Lossy
Stream size                              : 1.06 MiB (4%)
Encoded date                             : UTC 2013-04-04 15:54:02
Tagged date                              : UTC 2013-04-04 15:54:03

So what's the problem, variable bitrate?

Added: I did both x264/aac-mp4 versions with standard bitrate, did not work.
Title: Re: x264/mp4 problem
Post by: styrol on April 06, 2013, 07:59:27 AM
Unfortunately I do not see any crucial and suspicious differences in settings.
You may try to play file_2 via DLNA instead of USB once.
You may remux file_2 using ffmpeg and try playing again on your TV:
ffmpeg -i file_2.mp4 -vcodec copy -acodec copy file_2_new.mp4
You may try other software like handbrake if you don't have to cut your files.
Title: Re: x264/mp4 problem
Post by: Jan Gruuthuse on April 06, 2013, 12:29:40 PM
differences:
General
Overall bit rate                        : 3 492 Kbps <> Overall bit rate                          : 3 494 Kbps
Video
Maximum bit rate                        : 10.9 Mbps <> Bit rate mode                            : Variable
Minimum frame rate                     : 29.412 fps <> Minimum frame rate                    : 29.402 fps
Audio
Maximum bit rate                            : 184 Kbps <>

Title: Re: x264/mp4 problem
Post by: styrol on April 06, 2013, 01:25:21 PM
Yep, there are differences, but I think the muxer (or whatever) is just doing a slight different kind of tagging, e.g. it does state "Variable" instead of specifing the Maximum bit rate and it does not read/include  "Title:  (C) 2007 Google Inc. v08.13.2007".

The slight difference concerning the numbers could be a rounding issue. And be aware this is just a copy/copy issue (no re-encoding) if I understood it correctly.
Title: Re: x264/mp4 problem
Post by: Vonhonk on April 07, 2013, 07:37:41 AM
Quoteffmpeg -i file_2.mp4 -vcodec copy -acodec copy file_2_new.mp4
I did this to the damaged copy. Did not fix it. Previously, I used transcode to convert my videos. I like Avidemux way more, wouldn't like to go back to command line again.
QuoteThe slight difference concerning the numbers could be a rounding issue.
How?
QuoteAnd be aware this is just a copy/copy issue (no re-encoding) if I understood it correctly.
Nope. Copying or re-encoding does not make any difference, both produce the same result, meaning a non-playable file.
What then? The produced file is 4 bytes longer and I remember reading somewhere that if the first byte of the fileis in some way "wrong", Samsung won't read it. I don't remember what it was.
Further suggestions?
Title: Re: x264/mp4 problem
Post by: Vonhonk on May 26, 2013, 09:46:48 AM
Just to let you know: the h264/AC3-combination stopped working. :'(
That's it! Now there is no way I can convert anything!