Link to home
Start Free TrialLog in
Avatar of kamlendu_shekhar
kamlendu_shekhar

asked on

Problem while playing video

Hi,

I took a video from a Sony camera, it is in format MPG(video_name.MPG) . I converted that from MPG to "AVI" using "ffmpeg" as

# ffmpeg -i MOV06383_orig.MPG <output_file.AVI>

But I am not able to play the out put file using windows media player.

Then I took another video from Yashica camera which stores in "AVI" format as "image_name.AVI" . I am able to play this video using same media player.

Can you please tell me why I am not able to play the video in first case.

My ultimate aim is to play the video taken by Sony camera in Yashica camera by converting it to proper format.

Can you please tell me how can I achieve this.


Note: I am using Linux for my development purpose.

Thanks,
Kamlendu  
Avatar of Murali
Murali
Flag of India image

Which version of Windows Media Player you use?
Avatar of kamlendu_shekhar
kamlendu_shekhar

ASKER

I am using the default media player came with windows server 2003. I don't know much about windows, but it looks like version 10.00.00.3700

But here this is not important as I want to play video in Yashica camera, windows media player is just an intermediate testing point.

I have do the conversion on video file only, I can not do anything on player. This is the limitation I have.

Can you please advise.

Regards,
Kamlendu
The following command lines produced AVI files that were playable with the default WinXP/SP2 installation of Windows Media Player:


ffmpeg -i <inputfile.ext> -vcodec msmpeg4 -vtag MP43 -acodec libmp3lame
      This is the same as the infamous 'DIV3' DivX ;-) codec. However, if the '-vtag' option is omitted, the 'DIV3' tag will be inserted by default and WMP will reject the video format.

ffmpeg -i <inputfile.ext> -vcodec msmpeg4v2 -acodec mp3
      use Microsoft MPEG-4v2 video
     
ffmpeg -i <inputfile.ext> -vcodec wmv7 -acodec mp3
      use Microsoft WMV7
</inputfile.ext></inputfile.ext></inputfile.ext>
I tried these commands, but they are not able to produce the avi files.
These are the logs,

kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$ ffmpeg -i MOV06383_orig.MPG -vcodec msmpeg4 -vtag MP43 -acodec libmp3lame output.avi
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
[mpeg @ 0x90e4290]invalid dts/pts combination
    Last message repeated 46 times
Input #0, mpeg, from 'MOV06383_orig.MPG':
  Duration: 00:00:13.96, start: 0.110000, bitrate: 2915 kb/s
    Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, s16, 64 kb/s
    Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 25 tbr, 90k tbn, 25 tbc
Unknown encoder 'libmp3lame'
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$

===================================
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$ ffmpeg -i MOV06383_orig.MPG -vcodec msmpeg4 -acodec mp3 output.avi     FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
[mpeg @ 0x8ee3290]invalid dts/pts combination
    Last message repeated 46 times
Input #0, mpeg, from 'MOV06383_orig.MPG':
  Duration: 00:00:13.96, start: 0.110000, bitrate: 2915 kb/s
    Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, s16, 64 kb/s
    Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 25 tbr, 90k tbn, 25 tbc
Unknown encoder 'mp3'
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$
====================================================

kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$ ffmpeg -i MOV06383_orig.MPG -vcodec wmv7 -acodec mp3 output.avi
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
[mpeg @ 0x9afd290]invalid dts/pts combination
    Last message repeated 46 times
Input #0, mpeg, from 'MOV06383_orig.MPG':
  Duration: 00:00:13.96, start: 0.110000, bitrate: 2915 kb/s
    Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, s16, 64 kb/s
    Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 25 tbr, 90k tbn, 25 tbc
Unknown encoder 'wmv7'
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$

***************************************************************

One more info I want to give, the avi file which is playing correctly has
Audio Sample size 8bit
Audio Format PCM

So earlier only I tried option "-acode pcm_u8"
By this I am getting the similar avi file, but that is also not playing.
First part seems to be solved. In first command,

ffmpeg -i MOV06383_orig.MPG -vcodec msmpeg4 -vtag MP43 -acodec libmp3lame output.avi

I changed the option "-acodec libmp3lame" to "acodec pcm_u8".

i.e, now the command is

ffmpeg -i MOV06383_orig.MPG -vcodec msmpeg4 -vtag MP43 -acodec pcm_u8 output.avi

Now I am able to play it in media player. I am going to test it on Yashica camera.
I will let you know if I will face some problem.

Thanks
Kamlendu
Hi,

I am back again. Here is the problem.
If I put the "AVI" file which I created using ffmpeg just now,  in yashica camera SD card, camera is not able to play the video.

Camera is able to play the video which is taken by it. and those are also in same format "avi", but in case of my video it says "unrecognized file format".

Can you please suggest me, what should I do in order to play the video in the camera.

Regards,
Kamlendu

The avi file format is an containerformat. This means that different codecs can be used to store the data in an avi file. I'd suggest, the second camera/player cannot handle the codec and/or resolution

If you want to transcode from one format to another you need to know which resolution and codec you have to use.

try running "ffmpeg -i video.avi" with an working avi file from the Yashica camera to see information about used codecs and so on.
Then transcode the mpg to avi with the needed codecs.

Hi,

Thanks. I am doing this. This is the output of a working file in Yashica camera,

kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$ ffmpeg -i ALIM0728.AVI
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
Input #0, avi, from 'ALIM0728.AVI':
  Duration: 00:00:11.53, start: 0.000000, bitrate: 7075 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 28.87 tbr, 28.87 tbn, 28.87 tbc
    Stream #0.1: Audio: pcm_u8, 22050 Hz, mono, s16, 176 kb/s
At least one output file must be specified
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$
*******************************************************

I am trying to set the exectly same same parameters, but I am not able to set the "-pix_fmt" as "yuvj422p"

I am looking on this. By the time can you please suggest me if you have some idea how can I do this.

Regards,
Kamlendu
Hi,

finally I am using this command for the conversion,

# ffmpeg -i MOV06383_orig.MPG -b 10000000 -vcodec mjpeg -pix_fmt yuvj422p -acodec pcm_u8 -ar 22050 op_t1.avi

But still camera doesn't recognize the file.

Here is the output of a file which plays fine in camera and other which I created just now,

O/P of file which plays in camera
==========================
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$ ffmpeg -i ALIM0728.AVI
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
Input #0, avi, from 'ALIM0728.AVI':
  Duration: 00:00:11.53, start: 0.000000, bitrate: 7075 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 28.87 tbr, 28.87 tbn, 28.87 tbc
    Stream #0.1: Audio: pcm_u8, 22050 Hz, mono, s16, 176 kb/s
At least one output file must be specified
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$

*********************************************
O/P of a file which doesn't play in camera(created using ffmpeg"

kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$ ffmpeg -i op_t1.avi
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
Input #0, avi, from 'op_t1.avi':
  Duration: 00:00:14.08, start: 0.000000, bitrate: 6129 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, PAR 1:1 DAR 4:3, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: pcm_u8, 22050 Hz, mono, s16, 176 kb/s
At least one output file must be specified
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony

Any help will be appreciated.

Regards,
Kamlendu
==========================
This is a command that works for me:

ffmpeg -i test.mpg -s 640x480 -pix_fmt yuv422p -vcodec mjpeg -acodec pcm_u8 test.avi

Using ffmpeg v22511 this command transcodes the input video to mjpeg, with 640x480 resized with pixel format yuv422p using pcm_u8 audio.
Seems that the file that works with the camera uses 28 frames per second whereas the other one just uses 25 fps. Try adding "-r 28.87.

Also you probably need to adjust the PAR(PixelAspectRatio) and DAR(DisplayAspectRatio) with
"-aspect XYZ" (4:3, 16:9 or 1.3333, 1.7777).
The "-aspect" can also take 1:1 as parameter
ffmpeg -i test.mpg -s 640x480 -r 28.87 -aspect 4:3 -pix_fmt yuv422p -vcodec mjpeg -acodec pcm_u8 test.avi
Hard Luck,

Still I am not able to play.

Command I used,

ffmpeg -i MOV06383_orig.MPG -b 10000000 -s 640x480 -r 28.87 -aspect 16:9 -pix_fmt yuvj422p -vcodec mjpeg -acodec pcm_u8 -ar 22050 op_t1.avi

# ffmpeg output of a file I got,

kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$ ffmpeg -i op_t1.avi
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
Input #0, avi, from 'op_t1.avi':
  Duration: 00:00:14.06, start: 0.000000, bitrate: 6137 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, PAR 4:3 DAR 16:9, 28.87 tbr, 28.87 tbn, 28.87 tbc
    Stream #0.1: Audio: pcm_u8, 22050 Hz, mono, s16, 176 kb/s
At least one output file must be specified
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/sony$
==================================================================
O/P of file which plays in camera
==========================
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$ ffmpeg -i ALIM0728.AVI
FFmpeg version 0.5.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration:
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  built on Mar 30 2010 10:06:56, gcc: 4.4.1
Input #0, avi, from 'ALIM0728.AVI':
  Duration: 00:00:11.53, start: 0.000000, bitrate: 7075 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 28.87 tbr, 28.87 tbn, 28.87 tbc
    Stream #0.1: Audio: pcm_u8, 22050 Hz, mono, s16, 176 kb/s
At least one output file must be specified
kamlendu@kamlendu-desktop:~/Desktop/sampel_video/yashika$

------------------------------------------------------------------------------

Please tell me if you got any clue (:
Try to set the bitrate manually. This is the only thing that seems to differ from a working file.

"-b 7075" would be the right one

Also try to "play" with the aspect ratio. 640x480 is a 4:3 ratio, not 16:9 as you used.
No Luck (:-
While conversion I am getting this line,

[mpeg @ 0xa251290]invalid dts/pts combination

Can you please check if, this has some issue.

Same time can you please suggest me some open source tool, by which I can compare two avi files!
Ok, we're wide, wide away from your original question. You managed to play the video with the Winows Media Player.

First of all I'suggest you tell me the model # of your Yashica camera.

Then I can try to fetch a usermanual and hopefully get some info on what your camera supports to play.
The next step should be to read carefully the ffmpeg manual and try to find the perfect settings.
Model of my Yashica camera is "EZ8032"
and that of Sony is "DSCW30"

Please let me know if you need any more information.
Unfortunately Yashica  does not provides datailed informations on the format they like.

Below are all infos they provide and all useable information has been already tried out (640x480@30fps, 4:2:0, MJPEG)

Perhaps you can upload two small sample videos, one taken with the Sony, one with the Yashica.


Yashica Features
    * 2.5" LTPS TFT LCD (color no.:16,000K) , 150K Pixels (640x240)
    * Resolution: 8.2M Pixels
    * Aperture : F2.8 (W) / F4.9 (T)
    * Optical Zoom: 3X (step =1.1)
    * Digital Zoom: Up to 5.0X (step = 1.2)
    * Combined Zoom: 15.0X
    * Focal Length: f = 5.8mm (W), 17.4mm (T)¡]f = 35mm ~ 105mm, 35mm equivalent¡^
    * Photo Graphic Range: Normal: 0.5m ~ infinity (Wide); 0.8m ~ infinity (Tele)
      Macro¡G10 ~ 50 cm (Wide), 40 ~ 80 cm (Tele)
    * Shutter Speed: 8 to 1/1500 sec.
    * Memory
      Internal: 32MB NAND Flash
      External: SD/MMC removable card (support SDHC)
    * Image File Formats
      Still Image: JPEG (Exif 2.2), Movie: MJPEG (with .AVI format)
      File structure: DPOF , DCF1.1
    * Shooting Mode : Auto, P-Mode, Portrait, Night Portrait, Landscape, Scene, Macro, Video

Image Resolution:

    * Still Mode:
      - Resolution :
      3264x2448 (8M)
      3264x2176 (3:2) (7.1M),
      2576x1932 (5M)
      2048x1536 (3M),
      1600x1200 (2M)
      1920x1080 (16:9) (2.1M),
      640x480 (VGA)
      Movie mode:
      - Resolution
      640x480 @ 30fps; 320x240 @ 30 fps
    * Image Compression Control
      Still Image : Best (5:1), Better (8:1), Good (10:1) in 4:2:0 format
      Movie: 640x480, 320x240 in 4:2:0 format
    * Image Sharpness Control: High, Normal, Low
    * Sound Effect: Beep ,Shutter, and Power-on sound
    * Auto LCD Off: Off, 30 sec, 1 min
    * Auto Power Off: 2 min, 5 min
    * Language Supported (OSD): English /German /French /Italian /Spanish /Portuguese(Brazil) /Japanese/ Traditional Chinese /Simplified Chinese /Russian /Arabic /Turkish/Dutch

Camera Features (Taking Picture)

    * Scene : Sport, Night Landscape, Museum, Snow, Sunset, Fireworks, Beach, Party, Backlight, Copy
    * White Balance: Auto, Sunny, Tungsten, Fluorescent, Cloudy
    * ISO Equivalent: Auto, ISO 80, 100, 200, 400, 800, 1250
    * Exposure Control: TTL auto F/W program control
    * Exposure Metering: Matrix (Intelligent AE), Average, Spot
    * Exposure Compensation: Selectable +/- 2.0 EV with 0.3 EV steps
    * AF Focus Method: Single AF (default), Continuous AF
    * Focus Mode: Multi-zone, Single-zone (Center, Selected area)
    * Flash: Auto, Off, Fill, Red Eye,
    * Flash Range: GNo.: 5.4 @ ISO 100
      Wide: Operating Range 0.5 ~ 2.5m @ ISO Auto
      Tele: Operating Range 0.8 ~ 1.5m @ ISO Auto
    * Color Mode: Vivid, Color, Sepia, B/W
    * Image Capture Mode: Single, Burst @ 2fps (AF fixed), Multi-Burst (VGA 16 shots in selectable 1/7.5, 1/15, or 1/30 sec interval)
    * Long Exposure Time: Up to 8 sec.

Camera Features (Playback)

    * Playback magnify: Up to 6X (starting from 2X to 6X, step=0.5X)
    * Slideshow playback: Sequential, or Index playback with selectable interval
    * Image Editing: Crop, Resize, Rotate
    * Movie Editing: Divide, Review (Skip, Pause, FFW, FRW)
    * Move Image: Move Still image and Movies from internal to external memory card
    * Date and time stamp: Yes/No, user selectable
    * Formatting: FAT16, FAT32
    * LCD Review/Preview: Normal : 30fps
    * Voice Memo
    * Histogram
    * Video output :NTSC/PAL
    * Build-in microphone (in the front side) and speaker
    * Battery: NP-40 compatible Lithium-ion battery, 680 mAH
    * Dimension: 90 x 60 x 22 mm
I am attaching two videos, the first one(ALIM0692.doc) is taken by Yashica and playing well in camera.
(Please rename .doc to .AVI as I am not able to attach .AVI files.

The 2nd one MOV06383.doc is taken by sony(pleas change the extension to MPG).

Regards,
Kamlendu
ALIM0692.doc
MOV06383.doc
ASKER CERTIFIED SOLUTION
Avatar of nanocosm
nanocosm
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

It seems like this solution works. I am able to play the video. :)

Thanks a lot.

I will get in touch with you, if I will get any problem in future.

Thanks again.

Regards,
Kamlendu
It seems like this solves my problem.

I will get in touch if I feel any problem.